With the exception of one Linux server, which performs URL routing, all our Linux servers have jobs to do, and send email out when their jobs have completed. All our Linux servers run sendmail, but sendmail is being used in its crudest form. It’s not serving in its full capacity, but its only job is to move email off each Linux server to our email server, and does so with a Perl shim that logs into our email server using a valid user name.
Over the past few years, our email server has needed replacing. Its disks get full, and it cannot accept more incoming mail. I’ve never bothered to tune sendmail, but have now resorted to something crude that I hope will prevent our Linux servers from many, many retries, and hanging due to one of many conditions, including running out of memory.
# A $? -eq 1 means the mail server is running. That is ?Invalid command was not found. (echo open mailserver.arlington1.local 25; sleep 1; echo EHLO; echo quit) | telnet | grep "?Invalid command" if [ $? -eq 1 ]; then if [ -r /tmp/sendmail_stopped ]; then rm /tmp/sendmail_stopped /etc/init.d/sendmail start mail -s "sendmail has started back up." firstname.lastname@example.org << /dev/null else echo "sendmail OK" fi else if [ ! -r /tmp/sendmail_stopped ]; then touch /tmp/sendmail_stopped /etc/init.d/sendmail stop else echo "sendmail still not OK" fi fi
So far, so good. I’m hoping to shutoff sendmail and hence shutoff retries, so I don’t have to force reboot our Linux servers.