-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Bryan Phinney
Sent: 12 August 2005 14:01
To: [email protected]
Subject: Re: [newbie] Script to detect running process.


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



Or you could use the monitor option in webmin.

Tony.


-+-+-+-+-+-+-+-+-+ Business Computer Projects - Disclaimer -+-+-+-+-+-+-+-+-+-
This message, and any associated attachment is confidential.  If you have 
received
it in error, please delete it from your system, do not use or disclose the 
information
in any way, and notify either the sender or [EMAIL PROTECTED] immediately.
The contents of this message may contain personal views which are not 
necessarily 
the views of Business Computer Projects Ltd., unless specifically stated.  
Whilst every
effort has been made to ensure that emails and their attachments are virus 
free, it is 
the responsibility of the recipient(s) to verify the integrity of such emails.
Business Computer Projects Ltd
BCP House
151 Charles Street
Stockport
Cheshire
SK1 3JY
Tel: +44 (0)161 355-3000
Fax: +44 (0)161 355-3001
Web: http://www.bcpsoftware.com

____________________________________________________
Want to buy your Pack or Services from Mandriva? 
Go to http://store.mandriva.com
Join the Club : http://www.mandrivaclub.com
____________________________________________________

Reply via email to