Skip to content

Instantly share code, notes, and snippets.

@mvidaldp
Last active January 16, 2021 23:11
Show Gist options
  • Save mvidaldp/f3a49fcb21c3034eda3771bc78d21b49 to your computer and use it in GitHub Desktop.
Save mvidaldp/f3a49fcb21c3034eda3771bc78d21b49 to your computer and use it in GitHub Desktop.
Example systemd unit service to schedule a reboot/shutdown at a specific time
[Unit]
Description=Shutdown at specific time
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
# remove the scheduled shutdown if any
ExecStartPre=/sbin/shutdown -c
# change to desired time, -r (restart), -P (poweroff/shutdown)
ExecStart=/sbin/shutdown -r 00:00
[Install]
WantedBy=default.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment