Wednesday 18 January 2017

Schedule a Shutdown in Linux

Scheduling a Shutdown in Linux, unlike Windows is a piece of cake.

The Windows Way

  1. Create a bat file executing run/win32/shutdown.exe.
  2. Schedule this using Windows Schedule Manger

Linux Way

Linux offers you tons of ways, forget at command or even cron. You can achieve this in one single command.



shutdown -h 05:00

This command will shutdown the machine the machine the instant the computer clock reaches 05:00 hours once.

What happens if this time instant has passed already?

In case the this time instant occurs on the same day. It will scheduled for the same day. Else this will be scheduled for the next day.
This will schedule the shutdown just once.

Terminal Output


super@super-PI945GCM:~$ date
Wed Jan 18 23:45:27 IST 2017
super@super-PI945GCM:~$ shutdown -h 05:00
Shutdown scheduled for Thu 2017-01-19 05:00:00 IST, use 'shutdown -c' to cancel.


You might be interested in our other articles dealing with automation


No comments:

Post a Comment