Last active
February 1, 2024 13:47
-
-
Save jornane/60ae9e9664a787e4f288f192e528bad0 to your computer and use it in GitHub Desktop.
Enable automatic updating on CentOS 8
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
# NOTE: Need at least 8.1, does not work on 8.0 | |
dnf install -y dnf-automatic | |
sed -i -e '/apply_updates/ s/no/yes/' /etc/dnf/automatic.conf | |
tee /etc/cron.daily/0autoreboot.cron <<EOF | |
#!/bin/sh | |
dnf needs-restarting -r >/dev/null || { reboot; exit 0; } | |
EOF | |
chmod +x /etc/cron.daily/0autoreboot.cron | |
systemctl enable --now dnf-automatic.timer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment