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.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Linux from Scratch, Ubuntu 14.01 Beta and Arch Updates