Automatic updates

Automatic updates #

This is how I make OpenBSD update automatically using cron.

Warning:
The OpenBSD project doesn’t recommend mindlessly updating current from cron. It’s probably a bad idea if you’re running a server. It however is possible and I like it for my home PC.

Packages #

To have packages updated automatically after all system upgrades, create the file /upgrade.site with this content:

echo 'pkg_add -Iu -Dsnap' >>/etc/rc.firsttime

Make the file executable using chmod +x.

Snapshots #

To have snapshots installed every night at 3 am, create the file /etc/crontab with this content:

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
  0  3  *  *  * root      sysupgrade -s

Patches #

Alternatively, if you’re following stable rather than current, you can instead use this:

0  3  *  *  * root      syspatch && reboot

Manuals #

See also #