in reply to Mechanism for ensuring only one instance of a Perl script can only run?
You could use a pid file for that. This is, as far as I know, the mechanism commonly used by server software.
At start up, Your script checks if there is already a file with a given name, usually yourscript.pid in a directory, usually /var/run. If there is one it may read the contents which would be the process id of the already running instance and print an error and exit.
.If there is none, Your script would create yourscript.pid and write its pid to it. Before the script exits, it deletes the file.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Mechanism for ensuring only one instance of a Perl script can only run?
by afoken (Chancellor) on Dec 04, 2022 at 18:42 UTC | |
by rizzo (Curate) on Dec 06, 2022 at 03:34 UTC | |
by hv (Prior) on Dec 06, 2022 at 05:10 UTC | |
by afoken (Chancellor) on Dec 06, 2022 at 19:47 UTC | |
by hv (Prior) on Dec 07, 2022 at 03:06 UTC | |
| |
by rizzo (Curate) on Dec 07, 2022 at 01:24 UTC |