1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.
SimpleDaemon
A fork of Shane Hathaway’s daemon.py script.
Features
reads the command line
reads a configuration file
configures logging
calls root-level setup code
drops privileges
calls user-level setup code
detaches from the controlling terminal
checks and writes a pidfile
Installation
- ::
pip install simpledaemon
Example
Writing a daemon requires creating two files, a daemon file which simply enters an infinite loop and does whatever you want it to do, and a configuration file with the same name which tells simpledaemon how to setup your daemon.
hellodaemon.py:
import simpledaemon
import logging
import time
class HelloDaemon(simpledaemon.Daemon):
default_conf = '/etc/hellodaemon.conf'
section = 'hello'
def run(self):
while True:
logging.info('The daemon says hello')
time.sleep(1)
if __name__ == '__main__':
HelloDaemon().main()
hellodaemon.conf:
[hello] pidfile = ./hellodaemon.pid logfile = ./hellodaemon.log loglevel = info
Usage
To use your new daemon, execute your script like so:
./hello.py --start
Stopping is similar:
./hello.py --stop
For a full list of options, see the help:
./hello.py --help
Bugs
If you come across any bugs in simpledaemon. Kindly file an issue at: https://bitbucket.org/donspaulding/simpledaemon/issues/new
Pull requests are also welcome.
Metadata
Release files for SimpleDaemon 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
File added late
1 file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release files before installing.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| SimpleDaemon-1.3.0.tar.gz | 7.1 kB | Details |
Release files / SimpleDaemon-1.3.0.tar.gz
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | SimpleDaemon-1.3.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb1f3a5baacbfc770227f6837b01d8dcd0454e90f75c385f6a1b7b74fa80e64c
|
|
BLAKE2b-256 checksum How to use checksums |
d3020860504de21058537d13213d9058dc6cb33c06f90bd43cabd606ab47c7a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |