HP-UX Sendmail Issues

Posted by mwguy on Tue 03 September 2013

Another HP-UX tip here. If you find yourself with a filling up /var you may want to check the mail directory on HP-UX. That's the diagnosis for this fix. Sendmail on HP-UX isn't the most stable thing running out there. It definitely wouldn't be described as "Rock Solid." So occasionally it will crash.

But just starting sendmail back up again is not the way to go. You're going to find yourself with an interesting problem where senmail will run but it will not actually send mail. The problem is a lock file on the filesystem that keeps sendmail from doing it's job.
If you're looking through /var/adm/syslog/mail.log and you see a log entry that looks like this:
relay=root@localhost Som 4 TI:ME mefinbox sendmail[somenum]: somelongcharnums: timeout waiting for input from local during Draining Input
You need to kill sendmail's lock file. It's located in /var/mail/root.lock . For us we also had a large /var/spool/mqueue directory, so large infact that doing a rm /var/spool/mqueue failed because the command was too big. Instead we needed to do a ls /var/spool/mqueue | xrags rm.
For quick reference here's what we did to fix the problem. In the end we created a cron script to monitor and fix sendmail problems (but as all scripts created at my workplace it's not my script to share):
/sbin/init.d/sendmail stop
rm /var/mail/root.lock              #Remove pesky lock file
ls /var/spool/mqueue | xargs rm     #Depending on how long sendmail is down mqueue
                                    #May be too big to run any other way
ps -ef | grep sendmail              #Find the processes and kill them off manually
/sbin/init.d/sendmail start         #You should be back up and running.

It is my suggestion that you watch the log file for a while for signs of errors. Happy sendmailing

tail -f /var/adm/syslog/mail.log #Watch for error (optional)