![]() |
|
Don't ask to ask, just ask | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
why re-invent the wheel when there is already Proc::ProcessTable which you can enquire about your current processes? (and this approach was already mentioned in your previous question, see Re: Mechanism for ensuring only one instance of a Perl script can only run?) Secondly, you hardcode /usr/bin/perl in the shebang and also in the script but those who will inherit the script will know that? And you assume that who runs the script will do it without appending it with a perl interpreter executable. Thirdly, "simpler" may be but does it work under all conditions and circumstances? Hmmm. I would say, stick either with flock/highlander or with the shared-memory approach of Script::Singleton (my preference is with the memory-based approach which is more universal than the file-system approach). Btw, if( index($line,$dirPerl) != -1 && index($line,$name) != -1 ) can be replaced with a regex In reply to Re: Ensure Only One Instance of Your Script is Running... with 'ps -ef' ?
by bliako
|
|