Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Preventing multiple instances

by jszinger (Scribe)
on Dec 16, 2020 at 22:32 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2021-05-11 14:44 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (117 votes). Check out past polls.