Monday, March 14, 2011

Python lockfiles

The python-daemon library has a nice implementation of pidfiles, much better than the standard lib lockfile. i.e.

import lockfile.pidlockfile as pidlock
lf = pidlock.PIDLockFile("/tmp/mqtask.pid")

# module methods
pidlock.read_pid_from_pidfile
pidlock.remove_existing_pidfile
pidlock.write_pid_to_pidfile

No comments: