Syntactic Confectionery Delight | |
PerlMonks |
Re: Preventing multiple instancesby jszinger (Scribe) |
on Dec 16, 2020 at 22:32 UTC ( [id://11125310]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|