Fedora 24: Auto dnf update

This article will describe auto dnf update with dnf-automatic.

 

1 dnf-automatic

Install dnf-automatic according to Fedora Manual.

$ sudo dnf install -y dnf-automatic
$ sudo sed -i 's/apply_updates = no/apply_updates = yes/g' \
/etc/dnf/automatic.conf
$ sudo systemctl enable dnf-automatic.timer
$ sudo systemctl start dnf-automatic.timer

dnf-automatic.timer is ticked 1 hour later after boot and ticked every day. This is not exact time. This is for desktop environment.

$ cat /usr/lib/systemd/system/dnf-automatic.timer
<snip>
[Timer]
OnBootSec=1h
OnUnitInactiveSec=1d
<snip>

2 dnf-automatic does not support reboot

There is a tools which tells hint for retarting like dnf needs-restarting, but it needs some tricks.

This article uses a simple way that run dnf update and reboot with cron job without dnf-automatic.

$ sudo systemctl stop dnf-automatic.timer
$ sudo systemctl disable dnf-automatic.timer
$ (sudo crontab -l; \
echo "0 0 * * 0 dnf update -y  && /usr/sbin/reboot") | \
sudo crontab