Schedule shutdown timing in Linux systems are easy and it can be done through simple commands.
Various Shutdown commands
1. To Shutdown/Halt/Reboot the system immediately.
shutdown -h now # Halts the System immediately
shutdown -P now # Power Off System immediately
shutdown -r now # Reboots System immediately
2. To schedule the system to Halt in particular time in the same day.
shutdown -h HH:MM
e.g:
shutdown -h 22:15 # Halts the system at 10:15 PM
The Option -h denotes, halt the system. It means it leaves the system powered on in background, but stops all the CPU processes.
3. To schedule the system to Power Off in particular time in the same day.
shutdown -P HH:MM
e.g:
shutdown -P 11:30 # Power Off the system at 11:30 AM
The Option -P denotes, Power Off the system. It will send complete Power Off signal to all Hardwares.
4. To schedule the system to shutdown after specified duration.
shutdown -h +MM
shutdown -P +MM
e.g:
shutdown -h +30 #Halts the system after 30 minutes from now
shutdown -P +30 #Power Off the system after 30 minutes from now
How to Cancel the Scheduled Shutdown Signal
By using the above commands you can set/schedule the Shutdown timing. After you have scheduled the shutdown signal, anytime you can cancel the signal before it fires.
To cancel the Scheduled Shutdown Signal run the following command.
shutdown -c
If you have any questions, feel free to post the message in the commands section.