Operating System - HP-UX
1753536 Members
5486 Online
108795 Solutions
New Discussion юеВ

help on writing a script to clear files in /var/spool/mqueue

 
SOLVED
Go to solution
NDO
Super Advisor

help on writing a script to clear files in /var/spool/mqueue

Hi All

Please can you help me wrting a script to clear files in /var/spool/mqueue directories. The files are of the following type:
dfn3F6U3919153
tfn3F6U3919153
Tfp3BG0iH10642
qfp5HGUfb28340

This files are filling up /var


Fernando
5 REPLIES 5
Dennis Handly
Acclaimed Contributor

Re: help on writing a script to clear files in /var/spool/mqueue

NDO
Super Advisor

Re: help on writing a script to clear files in /var/spool/mqueue

Hi

Yes, you right,:

You should stop mail before running it:
/# sbin/init.d/sendmail stop

#!/usr/bin/ksh
# create file_list with:
# fgrep -l "yyyy xxxxxxx" > file_list
# find . -name "qf*" -exec fgrep -l "Returned mail: see transcript for details"
+ > file_list
# find . -name "qf*" -exec fgrep -l "Warning: could not send message for past 4
hours" + > file_list

for file in $( < file_list); do
base=${file#./[dq]}
base=${base#[dq]}
echo d$base q$base Q$base x$base
done | xargs -n1000 rm -f

BUT what I really dont understand is the "yyyy xxxxxxx" part, on the third line of your script.


Please can you explain


Fernando


Dennis Handly
Acclaimed Contributor
Solution

Re: help on writing a script to clear files in /var/spool/mqueue

>what I really don't understand is the "yyyy xxxxxxx" part, on the third line of your script.

I'm not sure any more, those were just some example comments. It's whatever you want to search for. Each of those lines are some examples that I used to clean up old messages and then the bounces and the re-bounces.
NDO
Super Advisor

Re: help on writing a script to clear files in /var/spool/mqueue

Hi

Ok, sorry if I did not understood at that moment, its clear now, I am going to do that. My apologises.


Fernando
Dennis Handly
Acclaimed Contributor

Re: help on writing a script to clear files in /var/spool/mqueue

>it's clear now, I am going to do that.

If you are happy with the answers given, please read the following about how to assign points:
http://h30499.www3.hp.com/t5/help/faqpage/faq-category-id/kudos#kudos