Skip to main content

create_pidlock

Create and verify pidfile.

If the pidfile already exists the program exits with an error message,
however if the process it refers to isn't running anymore, the pidfile
is deleted and the program continues.

This function will automatically install an :mod:`atexit` handler
to release the lock at exit, you can skip this by calling
:func:`_create_pidlock` instead.
def create_pidlock(
pidfile: string
) - > Pidfile

Create and verify pidfile. If the pidfile already exists the program exits with an error message, however if the process it refers to isn't running anymore, the pidfile is deleted and the program continues. This function will automatically install an :mod:atexit handler to release the lock at exit, you can skip this by calling :func:_create_pidlock instead.

Parameters

NameTypeDescription
pidfilestringThe file system path where the PID file will be created to manage the process lock.

Returns

TypeDescription
PidfilePidfile: used to manage the lock.