====================
This is a Python class that will daemonize your Python script so it can continue running in the background. It works on Unix, Linux and OS X, creates a PID file and has standard commands (start, stop, restart) + a foreground mode.
Based on [this original version from jejik.com](http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/).
Usage
---------------------
Define a class which inherits from `Daemon` and has a `run()` method (which is what will be called once the daemonization is completed.
from daemon import Daemon
class pantalaimon(Daemon):
def run(self):
# Do stuff
Create a new object of your class, specifying where you want your PID file to exist:
pineMarten = pantalaimon('/path/to/pid.pid')
pineMarten.start()
Actions
---------------------
* `start()` - starts the daemon (creates PID and daemonizes).
* `stop()` - stops the daemon (stops the child process and removes the PID).
* `restart()` - does `stop()` then `start()`.
Foreground
---------------------
This is useful for debugging because you can start the code without making it a daemon. The running script then depends on the open shell like any normal Python script.
To do this, just call the `run()` method directly.
pineMarten.run()
Continuous execution
---------------------
The `run()` method will be executed just once so if you want the daemon to be doing stuff continuously you may wish to use the [sched][1] module to execute code repeatedly ([example][2]).
[1]: http://docs.python.org/library/sched.html
[2]: https://github.com/serverdensity/sd-agent/blob/master/agent.py#L339
Metadata
Release files for py_daemon 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_daemon-0.1.2.tar.gz | 4.3 kB | Without provenance | Details for py_daemon-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_daemon-0.1.2-py2.7.egg | Legacy Egg format | - | - | Details for py_daemon-0.1.2-py2.7.egg |
Total release size: 12.0 kB
Release files / py_daemon-0.1.2.tar.gz
| Download URL | py_daemon-0.1.2.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8dc5aa09650c11be42931e7fec4dda96245ece214233d259743fba153a87f287
|
|
BLAKE2b-256 checksum How to use checksums |
974414be0149111e8b5c520d9597fcaca9036d3e5cb646132eacb655e4b5344a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / py_daemon-0.1.2-py2.7.egg
| Download URL | py_daemon-0.1.2-py2.7.egg |
|---|---|
| Size | 7.7 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
8ec590ab420c56223c41099883be8ba27576b5bd7b07a9effeb717263e5e49f0
|
|
BLAKE2b-256 checksum How to use checksums |
51d706be1f53d3e3363fe75279b15d3d8a7972e1622d9b2f55000a8e3d6b83df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for py_daemon 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.