Skip to content

Instantly share code, notes, and snippets.

@xezpeleta
Last active May 29, 2017 12:21
Show Gist options
  • Save xezpeleta/cb1611f2d7641a519410d69fe29dcb67 to your computer and use it in GitHub Desktop.
Save xezpeleta/cb1611f2d7641a519410d69fe29dcb67 to your computer and use it in GitHub Desktop.
Ubuntu server: reboot on "system restart required" with CRON
#! /bin/sh -e
#
# File: /etc/cron.daily/reboot-when-required
# Description: reboots the machine if its required
if [ -f /var/run/reboot-required ]; then
shutdown -r +5 "Reboot required. System will be restarted in 5min."
fi
@xezpeleta
Copy link
Author

Copy this file under /etc/cron.daily directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment