l.s.pidfile : module documentation

Part of lp.services

No module docstring
Function pidfile_path Return the full pidfile path for the given service
Function make_pidfile Write the current process id to a PID file.
Function remove_pidfile Remove the PID file.
Function get_pid Return the PID for the given service as an integer, or None
Function is_locked Check if a PID file is locked.
def pidfile_path(service_name, use_config=None):
Return the full pidfile path for the given service
def make_pidfile(service_name):
Write the current process id to a PID file.

Also installs an atexit handler to remove the file on process termination.

Also installs a SIGTERM signal handler to remove the file on SIGTERM. If you install your own handler, you will want to call remove_pidfile inside it.

def remove_pidfile(service_name, use_config=None):
Remove the PID file.

This should only be needed if you are overriding the default SIGTERM signal handler.

def get_pid(service_name, use_config=None):
Return the PID for the given service as an integer, or None

May raise a ValueError if the PID file is corrupt.

This method will only be needed by service or monitoring scripts.

Currently no checking is done to ensure that the process is actually running, is healthy, or died horribly a while ago and its PID being used by something else. What we have is probably good enough.

def is_locked(service_name, use_config=None):
Check if a PID file is locked.

Will remove an existing PID file if the owning process no longer exists.

API Documentation for Launchpad, generated by pydoctor at 2018-08-14 00:00:04.