Linux Backup Server: Remote Wakeup, Automatic Shutdown - page 2
NIC and Motherboard Support
You should modify your appropriate startup scripts to make sure that WOL is enabled every time your system starts up, even after an unclean shutdown. On Arch and Fedora Linux this is done in /etc/rc.local, like this:
stat_busy "Setting WOL to Active"
/usr/sbin/ethtool -s eth0 wol g
On Debian and its derivatives, edit the appropriate stanza in /etc/network/interfaces:
iface eth0 inet dhcp
post-up /usr/sbin/ethtool -s $IFACE wol g
post-down /usr/sbin/ethtool -s $IFACE wol g
With wakeonlan it doesn't matter if your server has a static or dynamic address, because it sends a broadcast packet to your whole subnet. Only the machine with the correct MAC address will respond.
The shutdown command should leave your system in the correct state for receiving WOL packets, which is a standby mode. This shuts off immediately:
# shutdown -h now
This shuts down two hours from now:
# shutdown -h +120
Broadcast message from root (ttyS0) (Mon Nov 22 20:10:51 2010):
The system is going DOWN for system halt in 120 minutes!
This shuts down at 6:00 PM:
# shutdown -h 18:00
To verify what your computer thinks the correct time is, run the date command.
Mon Nov 22 17:27:36 PST 2010
Ctrl+c cancels the shutdown.
Putting it All Together
At this point we have a decent manual system to start up the backup server remotely, run some backups, and have all systems shutdown by themselves after the backups are done. Come back next week for the final installment where it all gets put together in some simple scripts, and you never have to lift a finger again.
Carla Schroder is the author of the Linux Cookbook and the Linux Networking Cookbook (O'Reilly Media), the upcoming "Book of Audacity" (NoStarch Press), a lifelong book lover, and the managing editor of LinuxPlanet and Linux Today.
Sponsored by BlackBerry
BlackBerry® Enterprise Server Express enables businesses of any size to quickly and easily get started with the BlackBerry solution. It provides advanced BlackBerry smartphone features with no additional software or user license fees, and works with any Internet-enabled BlackBerry data plan or a BlackBerry enterprise data plan. Download now!