Linux Shutdown Management
Last Updated: Wed, Jul 8, 2009The Commands
Here are a few example of all the ways we can shutdown and reboot on a nix machine.
Power off the Machine Now
sudo halt
Shutdown 10 Minutes From Now
sudo shutdown -h +10 'Shutting down in 5 minutes!'
Reboot at 11pm
sudo shutdown -r 23:00
Cancel That
If you decide you don’t need to shutdown after all you can issue a cancel command like this:
sudo shutdown -c
Give a Shutdown Warning Without Actually Shutting Down
sudo shutdown -k now 'Hey I am going to the server room and this computer might get unplugged. Please save your work.'
Waking your Computer up
Here’s a command that tells your computer to wake up 5 minutes from now. To try enter the command and shut your computer down.
echo "+00-00-00 00:05:00" > /proc/acpi/alarm
Reboot Daily with Cron
Open up cron as root with, ‘sudo crontab -e’ and add the following line to reboot each night at 11:55pm.
55 23 * * * reboot