This is a beginner’s guide shows how to automatically shutdown or reboot Ubuntu Linux with a given clock time or after certain time.
Linux has a
shutdown command which can be run via:
shutdown [OPTIONS] [TIME] [WALL ...]
Where [OPTIONS] can be:
--poweroff, do power off action (default option).
--reboot, reboot the machine.
-h, equivalent to
-c, cancel a pending shutdown.
The [TIME] can be:
hh:mm, 24h clock time hour:minute.
+m, a certain time in minute.
now, same to
And [WALL …] is a wall message to be sent to all logged-in users before going down.
Linux shutdown command examples:
terminal or log in your Ubuntu Linux server and run following command as you want.
1. Automatic shutdown or restart after certain time
All the following 4 commands will DO SAME thing: auto-shutdown system after 2 hours.
shutdown -h +120
shutdown --poweroff +120
shutdown -P +120
Run either command below to restart 30 minutes later:
shutdown -r +30
shutdown --reboot +30
2. Automatic shutdown /reboot at given clock time
All the following 4 commands will DO SAME thing: automatic shutdown at 6 pm.
shutdown -h 18:00
shutdown --poweroff 18:00
shutdown -P 18:00
Either command below will restart system at 7 am:
shutdown -r 07:00
shutdown --reboot 7:00
3. Shutdown or reboot now:
shutdown -r now
4. Shutdown or reboot and send message to all logged in users.
shutdown +60 "System is going down in 60 minutes"
shutdown -r 18:00 "System will restart at 6pm"
For graphical tools to schedule shutdown / reboot your machine, scroll down and see the next post.