Don't know if anyone else is interested in this, but I am running a script on 
my server that does a check on certain processes and if it doesn't find them, 
it attempts to restart the process.  I find this useful on those rare 
occasions when a process might terminate unexpectedly due to some anomaly 
like a malformed update for Antivirus or the like.  I am including a small 
excerpt here just in case anyone is interested.

#!/bin/sh
# Script to check for processes on system
# and restart them if they have stopped.

#Web Server processes
# mysqld
mysqld_status=`ps -A | grep mysqld`
        if [ "$mysqld_status" = "" ]; then
                /etc/init.d/mysqld restart 2>&1 | /bin/mail -s "mysqld 
restart" [EMAIL PROTECTED]
        else
                echo "mysqld already running"
        fi
# Apache
httpd_status=`ps -A | grep httpd`
        if [ "$httpd_status" = "" ]; then
                /etc/init.d/httpd restart 2>&1 | /bin/mail -s "Apache 
restart" [EMAIL PROTECTED]
        else
                echo "Apache already running"
        fi
# AV/Security processes
# clamd
clam_status=`ps -A | grep clamd`
        if [ "$clam_status" = "" ]; then
                /etc/init.d/clamd restart 2>&1 | /bin/mail -s "clamd restart" 
[EMAIL PROTECTED]
        else
                echo "clamd already running"
        fi

# freshclam
freshclam_status=`ps -A | grep freshclam`
        if [ "$freshclam_status" = "" ]; then
                /etc/init.d/freshclam restart 2>&1 | /bin/mail -s "freshclam 
restart" [EMAIL PROTECTED]
        else
                echo "freshclam already running"
        fi

# amavisd
amavisd_status=`ps -A | grep amavisd`
        if [ "$amavisd_status" = "" ]; then
                /etc/init.d/amavisd restart 2>&1 | /bin/mail -s "amavisd 
restart" [EMAIL PROTECTED]
        else
                echo "amavisd already running"
        fi

# snort
snort_status=`ps -A | grep snort`
        if [ "$snort_status" = "" ]; then
                /etc/init.d/snort restart 2>&1 | /bin/mail -s "snort restart" 
[EMAIL PROTECTED]
        else
                echo "snort already running"
        fi

-- 
Bryan Phinney


____________________________________________________
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com
____________________________________________________

Reply via email to