Showing posts with label mailman. Show all posts
Showing posts with label mailman. Show all posts

Thursday, January 20, 2011

Shell script for Monitering Mailman process


#----------------------------
# Monitering of mailman process
#----------------------------

unsent=`ls -l /var/spool/mailman/in/ | grep -v grep | grep -c ".pck"`
isAlive=`ps ax | grep -v grep | grep -c "mailmanctl"`
_host=`hostname`
_to=bogati@test.com

if [ $unsent -ne 0 ]; then
/etc/init.d/mailman restart > /dev/null 2>&1

/usr/sbin/sendmail -t <To: $_to
Subject: Mailman has been restarted.

Mailman has been restarted on $_host

EOF

elif [ $isAlive -eq 0 ]; then
        /etc/init.d/mailman start > /dev/null 2>&1

/usr/sbin/sendmail -t <To: $_to
Subject: Mailman has been started.

Mailman has been started on $_host

EOF

fi