Few days ago I have trouble in sleeping, then i have idea what if I turn the music on so I can fell a sleep soon, a moment later questions arise "who would turn off my laptop, when I was sleeping ?", quickly I look for the solution..
we can use linux basic commands to perform automatic system shutdown in ubuntu or even to switch the system on again. here is the command what i mean:
shutdown -h <desire time>
The command above can be use in two ways, that is:
 Automatic system shutdown (halt) using exact hour and minute/hh:mm.
example: shutdown -h 21:00
the command above will make system automatically shutdown a the time 09:00 PM
Automatic system shutdown (halt) a few minutes after command executed 
example: shutdown -h +60
the command above will make system automatically shutdown 60 Minutes after a command executed
if explanation above isn't clear, Here is some example  step by step how to make automatic shutdown (halt) in ubuntu by the time 11:00 PM
  • Open terminal, Applications > Accessories > terminal (or press Ctrl + Alt + T )
  • Go to #root mode ( type 'su'  in your terminal then enter your #root password)
  • Type this command to your terminal
       shutdown -h 23:00