Operating System - HP-UX
1756547 Members
2770 Online
108848 Solutions
New Discussion юеВ

Re: script to check mailq

 
Ahmed_58
Regular Advisor

script to check mailq

dears,
We had a problem with the mail server some mails not send by our UNIX HP server if they were made during the downtime. Therefore we need scripts to check the mailq in UNIX HP and notify us for pending mails if any.

anyone can help please.
Ahmed
4 REPLIES 4
Dennis Handly
Acclaimed Contributor

Re: script to check mailq

You need to parse the output of mailq and then if there are any messages send mail.

How much detail do you want, just the count?
Jeff Schussele
Honored Contributor

Re: script to check mailq

Usually just bouncing sendmail will clear the mail queue.

/sbin/init.d/sendmail stop
/sbin/init.d/sendmail start

If that doesn't clear them all then check the mail log for any undeliverable messages.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Suraj K Sankari
Honored Contributor

Re: script to check mailq

HI,
In your rc.local add this 2 line as JS said

/sbin/init.d/sendmail stop
/sbin/init.d/sendmail start

So when your machine will restart after downtime it will execute the rc.local script

Suraj
Ahmed_58
Regular Advisor

Re: script to check mailq

dears,
The problem is when our mailling server is down, and our HP-UX server send email from the application it is queued and not send when the malling server become up, I need to have a way to check and send any queued messages.

from your answers I can see by stop/start will send all queued mail, is this the best approch?

Thanks,
Ahmed