Created
August 25, 2022 07:33
-
-
Save unquietwiki/0434712bee34f1d62bb8255c2140bbb4 to your computer and use it in GitHub Desktop.
Auto-maintain on Debian/Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/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