glue.pidfile module
A simple module for acquiring pidfile locks (e.g., for use by daemons).
Copyright (C) 2010 by Peter F. Couvares, Syracuse University mailto: pfcouvar@syr.edu
- glue.pidfile.confirm_lock(lockfile)[source]
Confirm that the given lockfile contains our pid. Should be entirely unecessary, but paranoia always served me well.
- glue.pidfile.get_lock(lockfile)[source]
Tries to write a lockfile containing the current pid. Excepts if the lockfile already contains the pid of a running process.
Although this should prevent a lock from being granted twice, it can theoretically deny a lock unjustly in the unlikely event that the original process is gone but another unrelated process has been assigned the same pid by the OS.