Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Preventing multiple instances

by jszinger (Scribe)
on Dec 16, 2020 at 22:32 UTC ( [id://11125310]=note: print w/replies, xml ) Need Help??


in reply to Preventing multiple instances

Locks (at least flock(2) and fcntl(2) in Linux and BSD) are maintained by the kernel, so if the system reboots, the lock goes away. The kernel also releases the lock when the process holding the lock terminates.

A PID file is the traditional approach, but needs file locking to prevent race conditions.

Perl’s built-in flock doesn’t require anything from CPAN.

One could also write a systemd unit that waits for the time to be set before starting a job. OnCalendar in a systemd.timer might work.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-19 06:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found