[ale] Only one process
Geoffrey
lists at serioustechnology.com
Mon Jun 7 11:59:00 EDT 2010
scott wrote:
> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
>
>
> On Jun 4, 2010, at 8:49 PM, JK wrote:
>
>> Doesn't anybody worry about race conditions any more? How do you
>> defend against multiple copies of this script running
>> simultaneously? Of course, cron *shouldn't* ever do that...
>>
>> flock(1) seems relevant:
>>
>> http://linux.die.net/man/1/flock
>>
>> -- JK
>
> when I write scripts that I dont want to run in parallel. I check
> for a /var/run/*.pid file related to the script and if the PID in it
> isnt mine, then I abort out. if the file isnt there, I create it with
> my PID. And when the script exits it removes the file.
Interesting approach, but I was just looking for a pid associated with
thunderbird there and it does not exist.;) (Sending this from thunderbird)
--
Until later, Geoffrey
"I predict future happiness for America if they can prevent
the government from wasting the labors of the people under
the pretense of taking care of them."
- Thomas Jefferson
More information about the Ale
mailing list