Skip to content

Instantly share code, notes, and snippets.

@da667
Last active September 10, 2021 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save da667/20f1c67c264f7823c7139f5c835a7026 to your computer and use it in GitHub Desktop.
Save da667/20f1c67c264f7823c7139f5c835a7026 to your computer and use it in GitHub Desktop.
updater shell script
#!/bin/bash
#updater.sh - Weekly update script
#checks for updates, downloads them, then reboots the system.
#place this script in /etc/cron.weekly, ensure it is owned by root (chown root:root /etc/cron.weekly/updater)
#ensure the script execute permissions (chmod 700 /etc/cron.weekly/updater)
#if you want updates to run once daily or monthly, you could also place this script into cron.daily, or cron.weekly.
#alternatively, edit /etc/crontab to create a crontab entry.
export DEBIAN_FRONTEND=noninteractive
apt-get -q update
apt-get -y -q dist-upgrade
logger updater cron job ran successfully. rebooting system
init 6
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment