Re: Only one instance of a script at a time !
| From: | Brian Clark | Date: | Fri, 28 Dec 2001 16:15:21 +0000 |
| Subject: | Re: Only one instance of a script at a time ! | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78954@lists.php.net to get a copy of this message | ||
* Nicolas Guilhot (nguilhot@gphy.campus.univ-poitiers.fr) [Dec 28. 2001 10:00]:
> I was thinking about this solution, but what can I do if the script ends
> prematurely. The file will never be deleted ??
It's a nasty hack, but you chould run a separate shell script to
check for the existance of the running script, then call the script
if it's not running.
something like (/bin/sh):
PID=
ps aux | grep [program] | grep -v grep | awk {'print $2'}
Replace [program] with the program name.
That'll get you the PID if the script is already running. You can kill
it, or just exit instead, for example. That's one way..
--
Brian Clark | Avoiding the general public since 1805!
Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8
$ mount -t neuro /dev/brain /mnt/head