http://www.perlmonks.org?node_id=11110170

luxs has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl-script which should be started automatically from cron. How can i check from this scripts, how many copies of this script already stated? At the moment i have only one idea, which works ,but looks not very nice 1. check process ID 2. read list of processes 3. find line with my ID and read how this scripts looks there (this is nesessary to avoid some mistakes related with non unique script name or other procesessa used this cript - for example editor) 4. find all identical lines in process list. lock or log file is not very good idea, becasue it is not protected from accidental script crash