Skip to content

Instantly share code, notes, and snippets.

@hyukishi
Last active February 6, 2019 18:07
Show Gist options
  • Save hyukishi/00f0d196fa92cf88500a27df6235ecee to your computer and use it in GitHub Desktop.
Save hyukishi/00f0d196fa92cf88500a27df6235ecee to your computer and use it in GitHub Desktop.
Updates all packages and autoremoves unneeded. Schedules a restart of the box for 5:00 AM.
#! /bin/bash
# Created by Jeffery Grantham on 2/6/2019
# Checking if "at" is installed. If not, apt-get will install it.
if [[ $(which at) != "/usr/bin/at" ]]; then
apt-get install at -y
fi
# Proceeding to check for updates
apt-get update
apt-get -y upgrade
apt-get -y autoremove
# Schedule reboot for 5:00 AM
echo "/sbin/shutdown -r now" | at 5:00 AM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment