[CentOS] Any one have a good example...

Morten Torstensen morten at mortent.org
Tue Aug 29 19:20:07 UTC 2006


Scott Silva wrote:
> ...of a shell script for rsync that won't start again if it is already running?
> I thought of using a lock file, but what if it is killed mid script or bombs?

You write your PID to the lock file, then in startup, you check if the lock file 
exist and if the PID process is running, then it is still active.

It could be that the process is just hung, so this method will only help assure 
that you do not start a second copy.

-- 

//Morten Torstensen
//Email: morten at mortent.org
//IM: Cartoon at jabber.no morten.torstensen at gmail.com

And if it turns out that there is a God, I don't believe that he is evil.
The worst that can be said is that he's an underachiever.



More information about the CentOS mailing list