On Friday 12 August 2005 06:36 am, James Henry Maiewski wrote:
> Hello,
>
> I'm trying to write whta I thought would be a simple script to start a
> program only if it were not already running. The closest I've come to
> a test is "skill -n -c command" which returns the process id, or
> nothing if it isn't running. Please help my feebleness.
I have a simple script that I use on my system to monitor processes and
restart them if they stop, end or are not running for whatever reason.
Here is a sample line for the clamd process.
#Antivrus and security
# clamd
clam_status=`ps -A | grep clamd`
if [ "$clam_status" = "" ]; then
/sbin/service clamd restart 2>&1 | /bin/mail -s "clamd
restart" [EMAIL PROTECTED]
else
echo "clamd already running"
fi
____________________________________________________
Want to buy your Pack or Services from Mandriva?
Go to http://store.mandriva.com
Join the Club : http://www.mandrivaclub.com
____________________________________________________