| title | Python daemon (background service) | |
|---|---|---|
| timestamp | 2019-06-25 00:40:01 -0700 | |
| tags |
|
|
| published | true | |
| books |
|
|
| author | szabgab | |
| archive | true |
Using the python-damon module:
{% include file="examples/python/mydaemon.py" %}
pip install python-daemon
python mydaemon.py
tail -f /tmp/echo.txt
$ ps axuw | grep mydaemon
gabor 7686 1.7 0.0 32692 15860 ? S 06:50 0:00 python examples/python/mydaemon.py
gabor 7692 0.0 0.0 14352 920 pts/1 S+ 06:50 0:00 grep --color=auto mydaemon
Use the process ID to stop the service:
kill 7686