To add to what @Iowan wrote, in addition to shutting down immediately shutdown can also be used to specify a time to turn off the machine.
Code:
# relative time
sudo shutdown -h +61 "turning off in an hour and one minute from now"
# or absolute time
sudo shutdown -h 17:00 "we'll shut down for the day at five o'clock"
One thing to double check is if your hardware requires an explicit power-off or halt. (-P or -H).** Some hardware will need one or the other or both and the OS will turn off but the power still run...
Code:
# from /etc/sudoers
%admin ALL=(ALL) NOEXEC: NOSETENV: NOPASSWD: /sbin/shutdown -[rhHPkc] [+0-9n][0-9\:ow]*
When testing scripts or parameters for shutdown, you can try -k to avoid actually shutting down the system. It's more useful in a mult-user environment.
If you have another machine available, even a router, on the same subnet with a wake-on-lan tool and if the server's network hardware can be activated with wake-on-lan, then you have ways to turn the machine on and off remotely.
Bookmarks