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: RHEL 6.7, BackBox Linux 4.3 and RoboLinux 8.1
- 2Linux Top 3: SLES 11 SP4, Chromixium OS 1.5 and Canonical Licensing
- 3Linux Top 3: VirtualBox 5, Point Linux 3.0 and OpenSUSE Leap 42.x
- 4Linux Top 3: Linux 4.2 rc1, 4MLinux 13 and antiX15
- 5Linux Top 3: Linux Mint Rafaela, OpenMandriva Lx 2014.2 and VectorLinux 7.1