This quick tutorial will show you how to schedule a task to shut down 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. (via Schedule Shutdown/Restart Tasks in Ubuntu 10.10 Maverick Meerkat | Liberian Geek.)
12.04 Precise Pangolin
The above method uses Gnome Scheduler and therefore will not work if we are using some other desktop like Cinnamon. For other desktops we have to use crontab. The detailed help for crontab is here. Though it looks scary but it is very simple.