On 27-Feb-2013, Chris Johnson wrote:
> Now what I am seeing is, multiple copies of my daemon are happy to run
> concurrently -- I expected to never have >1 instance running.

This is one of the main purposes of using a lockfile. They're not
specific to daemons, but your need is common: on start-up, the daemon
will exit if the lockfile already exists, and will create it
otherwise.

> Can you offer any advice?

The DaemonContext can be created specifying a lockfile context
manager, and will enter/exit the context when the daemon opens/closes.
Ensure that context manager tests for the lockfile and raises an
exception if it already exists.

This is the purpose of the ‘lockfile’ library. Use version 0.8
<URL:https://pypi.python.org/pypi/lockfile/0.8> which is the latest
version supported by ‘python-daemon’.

Or you can implement a different lockfile class to have your specific
desired behaviour.

-- 
 \      “Every man would like to be God, if it were possible; some few |
  `\          find it difficult to admit the impossibility.” —Bertrand |
_o__)                    Russell, _Power: A New Social Analysis_, 1938 |
Ben Finney <[email protected]>

Attachment: signature.asc
Description: Digital signature

_______________________________________________
python-daemon-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-daemon-devel

Reply via email to