Skip to content

Instantly share code, notes, and snippets.

@jornane
Last active February 1, 2024 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jornane/60ae9e9664a787e4f288f192e528bad0 to your computer and use it in GitHub Desktop.
Save jornane/60ae9e9664a787e4f288f192e528bad0 to your computer and use it in GitHub Desktop.
Enable automatic updating on CentOS 8
# 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