#!/bin/bash # You could run it from cron e.g /etc/cron.d/updatesystem with the line below it it # 0 4 * * 7 root /usr/local/bin/cronscripts/updatesystem >/dev/null 2>&1 # Remember to uncomment the cron entry line, and then copy this script to # /usr/local/bin/cronscripts/updatesystem # Remember to restart cron i.e systemctl restart cron.service # # Getting package list # apt update # # Updateting system # /usr/bin/unattended-upgrade -v # # Wait for things to settle then reboot # sleep 5m reboot
Note: # If you need to configure unattended updates there is a script [ Here ] you can use.