Skip to content

Instantly share code, notes, and snippets.

@unquietwiki
Created August 25, 2022 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unquietwiki/0434712bee34f1d62bb8255c2140bbb4 to your computer and use it in GitHub Desktop.
Save unquietwiki/0434712bee34f1d62bb8255c2140bbb4 to your computer and use it in GitHub Desktop.
Auto-maintain on Debian/Ubuntu
/opt/auto-maintain.sh
#!/bin/bash
apt update
apt autoremove -y
apt upgrade -y
reboot
/etc/systemd/system/auto-maintain.timer
[Unit]
Description=Auto-timed maintenance
Documentation=man:mandb(8)
[Timer]
OnBootSec=7d
Persistent=true
[Install]
WantedBy=timers.target
/etc/systemd/system/auto-maintain.service
[Unit]
Description=Auto-timed maintenance
[Service]
Type=simple
ExecStart=/opt/auto-maintain.sh
Requires=auto-maintain.timer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment