A set of classes and functions for managing pidfile.
Project description
uc_pidfile
A set of classes and functions for managing pidfile.
It is part of the Unicon project.
Using:
import uc_pidfile
Functions:
process_exists(pid)
Checks if the process is running. Returns True if process exists and False if not.
read_pid(filename)
Reads pid from file.
If the file exists and is successfully read, then returns pid otherwise returns None.
May raise exceptions:
- PermissionError
- ValueError
validate_pidfile(filename)
Checks the contents of pidfiles for an integer.
Returns True if valid or False if not.
May raise exceptions:
- FileNotFoundError
- PermissionError
is_running(filename)
Returns True if the process is running, otherwise returns False.
It will also be considered that the process is started even if there is no access to the file. And it will be considered that the process is not started if there is no file or the file contains incorrect data.
Classes:
PidFile(filename, overwrite=False)
Creates pid file.
If the file already exists and overwrite = True it will be overwritten. But if overwrite = false then this will throw an exception FileExistsError.
May raise exceptions:
- FileExistsError
- PermissionError
- FileNotFoundError (If the target directory does not exist, for example.)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for uc_pidfile-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73c42a71daaab62c686704b0b69d88f13ba722f079a7c42a9c4395ccfbd863a4 |
|
MD5 | 070492a82633a2dffb6945be7f24a8e9 |
|
BLAKE2b-256 | 0e2a69640e70bc326e2e8d31938d17b6df820f817c0c10022c92b88dd2cb9485 |