Saturday, March 10, 2012

Schedule A Task To Shutdown Or Restart Ubuntu Automatically

This quick tutorial will show you how to schedule a task to shutdown or restart your computer at a defined time in Ubuntu Lucid or Maverick. If you want your computer to automatically shutdown daily at midnight, or restart when all users are logged out, then this tutorial is for you.

Install gnome-schedule: sudo apt get install gnome-schedule

After installing Gnome Schedule, press Alt-F2 on your keyboard and type the command below:
gksu gnome-schedule

Then click ‘New’ and choose whether to create a Recurrent or One-time task.


Next, type the name and command of the task. Then enter the time you want to task to run. To make a task run at midnight daily, enter 0 for Minute, 0 for Hour (00:00) and Star for Day, Month and Weekday.  The * in the field below means to run regardless of the Day, Month or Weekday.
The command to restart is:
To shutdown is:

Then scheduled task below reads: Restart the computer at midnight daily.