#----------------------------
# 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
This is the blog about linux server and business English experience of my life.
Thursday, January 20, 2011
Shell script for Monitering Mailman process
Subscribe to:
Posts (Atom)