Created
July 13, 2018 12:09
-
-
Save sinewalker/4e3d228d6d2124a8bdcec4cf9cb4fffa to your computer and use it in GitHub Desktop.
ticktock systemd service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=ticktock | |
AssertPathExists=/home/mjl | |
[Service] | |
WorkingDirectory=/home/mjl | |
#unbuffered: | |
ExecStart=/usr/bin/python -u /home/mjl/ticktock.py | |
#buffered: | |
#ExecStart=/home/mjl/ticktock.py | |
StandardOutput=file:/tmp/ticktock.log | |
StandardError=inherit | |
Restart=always | |
RestartSec=3 | |
[Install] | |
WantedBy=default.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See ticktock.py for an example of what this runs.
This demonstrates how Python's buffering of output means that systemd journal (or even just straight streaming to a text file) will not update immediately unless you tell Python not to buffer (with the
-u
switch).Also see this Stack Exchange question