Whats the best way to make a script abort if an instance of it is already running? I'm on Linux.
I've done this with process id (pid) files and searching the process list from ps, but I don't know what the various pros and cons are. This seems like something that might have an established best-practice, so if you know it, I'd love to hear it.
Just in case I'm being unclear, I'll give an example. I have a process that runs every 10 minutes. It usually only takes 2 minutes to complete, but sometimes it takes 15 or 20 minutes. I don't want the new instance to step on the toes of the long-running earlier instance.
I've solved this before by the old time-honored tradition of making-something-up-as-I-go-along and I'd like to hear what other people think is the best way to handle this.
Thanks!
--Pileofrogs
In reply to Abort if instance already running? by pileofrogs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |