Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would you like to migrate to systemd to control the wordclock as a service? #246

Open
oxivanisher opened this issue Feb 10, 2023 · 1 comment · May be fixed by #250
Open

Would you like to migrate to systemd to control the wordclock as a service? #246

oxivanisher opened this issue Feb 10, 2023 · 1 comment · May be fixed by #250

Comments

@oxivanisher
Copy link
Contributor

oxivanisher commented Feb 10, 2023

I could help with that, if you would like that. Here are the things that work for me so far:

/etc/systemd/system/wordclock.service

[Unit]
Description=Wordclock
After=network.target

[Service]
ExecStart=/usr/bin/env python3 /home/pi/rpi_wordclock/wordclock.py
WorkingDirectory=/home/pi/rpi_wordclock/
Restart=always
RestartSec=5
KillSignal=SIGTERM
Type=simple
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=wordclock
NotifyAccess=all
User=root
Group=root
Nice=1

[Install]
WantedBy=multi-user.target

Systemd Howto

  • The daemon needs to read the new service file after creation or it does not know it exists: systemctl daemon-reload
  • The service can be started with: systemctl start wordclock.service
  • The service can be enabled with (aka started at system boot): systemctl enable wordclock.service
  • The last two commands can be combined into one: systemctl enable --now wordclock.service
  • The current state of the service can be checked with: systemctl status wordclock.service
  • The output can be watched with: journalctl -fu wordclock.service

IMHO (as a linux system engineer ^^) it would be nice to use a systemd unit, but I don't know if its seen as too complicated. Let me know what you think.

@bk1285
Copy link
Owner

bk1285 commented Mar 7, 2023

Hey @oxivanisher, I like the idea pretty much!

Feel free to start your work on latest main branch and open a PR, whenever you're done. Please ensure, that the documentation is also adopted accordingly.

... final note: Any idea how/when to register the service in /etc/systemd/system? That's probably a manual approach as part of the instructions, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants