Instantly share code, notes, and snippets.

Embed
What would you like to do?
Systemd unit files to restart service every two hours.
[Unit]
Description=Service that restarts my spread_goodness.service every two hours.
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl try-restart spread_goodness.service
[Unit]
Description=2hour timer
[Timer]
OnBootSec=0min
OnCalendar=0/2:00:00
Unit=two-hour.service
[Install]
WantedBy=basic.target
@Spidersonic

This comment has been minimized.

Spidersonic commented Apr 18, 2018

I'm currently trying to understand how timers work within systemd and this was very helpful and straight to the point. Thanks for sharing. ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment