Re: Cron - Any advanced options?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 23, 2009 at 09:03:43AM -0700, Brian Fox wrote:
> An exit is probably better than sleeping.

Especially given that it's going to run again in 7 minutes.

> I like the lockfile except for the need for a watchdog.  Something about
> "write the script correctly and you won't need a watchdog" never seems to
> apply in real life.

The usual way to handle this in Unix/Linux is to write your PID in the
lockfile.  The checking routine can then verify that the PID is still
active, in which case it honors the lock, or it's gone, and it can take
steps to remove the stale lockfile.  Avoids the need for a watchdog.

The only real problem with a lockfile is concurrency--just creating a
normal file, it's possible to hit the window between check and creation
with another process.  Unlikely, but.  That's why I like using a
semaphore.  Hmm...I see there's a 'lockfile' command now in Linux.
Don't know how good it is, but it's probably better than RYO.

Cheers,
--
	Dave Ihnat
	ignatz@xxxxxxxxxx

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux