Skip to content

Instantly share code, notes, and snippets.

@edpyt
Last active December 23, 2024 04:12
Show Gist options
  • Save edpyt/968170cec6bd7dac3cfe1d4131c4a5d5 to your computer and use it in GitHub Desktop.
Save edpyt/968170cec6bd7dac3cfe1d4131c4a5d5 to your computer and use it in GitHub Desktop.
Shutdown timer (systemd)

Source: https://linuxhandbook.com/schedule-shutdown/

sudo vim /etc/systemd/system/shutdown.timer
[Unit]
Description=Timer to shut down the system

[Timer]
OnCalendar=*-*-* 22:30
Persistent=true

[Install]
WantedBy=timers.target
sudo vim /etc/systemd/system/shutdown.service
[Unit]
Description=Service to Shutdown the system, run by a timer

[Service]
Type=oneshot
ExecStart=/sbin/shutdown now
sudo systemctl daemon-reload
sudo systemctl enable --now shutdown.timer
systemctl list-timers 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment