Categories
How-To

The Daily Reboot —

There are times when you had a bad system and know it.  And the action to keep it available is rebooting daily.  While I am not in favor of the reboot, it may be necessary.  So I use the following steps on a pesky Ubuntu server I know.

Log into your Ubuntu server and ‘sudo –i’ to enter the root console.  Place a file ( I named mine reboot ) in the /etc/cron.daily/ path with the following contents:

#!/bin/bash
reboot

 

This will create a very simple shell script to be run daily.  But for this to all work you need to also make that script executable or this will not work.

 

To make the script executable, do the following:

  1. Ensure your script is in the /etc/cron.daily/ path
  2. Modify your script to be executable by using the following commands  ‘chmod a+x /etc/cron.daily/<name of script (reboot in my case)>
  3. Ensure your script will run by running:  run-parts –test /etc/cron.daily/ – the output will be all scripts located in that path, if you see yours, then it is working

 

If you want to immediately run your script , run “run-parts –verbose /etc/cron.daily”