Skip to content

shutdown

a command to reboot a *nix server.

Linux Examples

Reboot a server in 5 minutes with a message

shutdown -r +5 "Please announce in #dev if you would like to cancel this reboot"

Power off a server in 5 minutes

shutdown -P +5

Cancel a scheduled shutdown

shutdown -c

Show when a shutdown will occur

awk -F= 'NR == 1 {print substr($2,0,length($2)-6)}' scheduled |
xargs -I{} date -d @{}

MacOS examples

Power off a machine in 5 minutes

shutdown -h +5 "Shutting down in 5 minutes"

or...

echo "Shutting down in 5 minutes" | shutdown -h $(date -v +5M +%y%m%d%H%M) -

Other functions

Using the above shutdown syntax, you can use -s for sleep, -r for reboot, and others. See man date for more.