Honorable monks,
I am seeking a solution to the following problem:
I have a script that runs in "demon mode" on a server, and does something every 10 seconds or so. More specifically, it looks for new files, and if it has found some, it does something else, and then copies files from folder A to folder B.
The script makes use of GetOpt::Long.
The script is not very bulletproof, though.
Occasionally I want to perform a one-off task, i.e. calling the same script with some other options, e.g. to move files from C to D.
If the script I am using for the one-off task is identical with the instance of the running script, it should immediately exit without doing any further work. If the options are different, it should perform its task. If the one-off task is already running, another attempt to run a second instance should fail.
How can I detect the command line options the permanently-running script has been called with? Is there a best way to do this? Has this problem been solved before (maybe with a special-purpose variant of GetOpt::Long or some obscure feature of GetOpt::Long) Just grab the %opts hash and compare entries?
In reply to Detect options of script runnning in a demon mode by knbknb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |