Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Preventing multiple instances

by jeffenstein (Friar)
on Dec 18, 2020 at 10:21 UTC ( #11125400=note: print w/replies, xml ) Need Help??


in reply to Re^2: Preventing multiple instances
in thread Preventing multiple instances

Assuming that the process is not running as root, you can kill -0 $(cat /path/to/file.pid) to see if the current user owns that process, or if it's running at all. Of course, lock the file before checking, and write the correct pid with the same lock.

There is Proc::Daemon which can take a pid file, but I haven't used it, so I don't know if it does the right thing.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11125400]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2021-05-11 12:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (116 votes). Check out past polls.

    Notices?