http://www.linuxplanet.com/linuxplanet/tutorials/7308/1
Unattended Linux Wakeup, Backup, Shutdown (part 5)The Master Plan, Cron WakeupsMarch 1, 2011 At last we come to the end of this series and put all the pieces together, and put our fabulous unattended automatic backup scheme to work. You need never lift a finger except to run periodic checks to make sure everything is working correctly. The first four parts: Antec 300 Computer Case Quick Review Arch Linux Backup Server-- Headless Administration Linux Backup Server: Remote Wakeup, Automatic Shutdown Linux Backup Server: Refining Rsync, Passwordless Authentication The PlanHere's how it all fits together:
Cron WakeupThe wakeonlan command does not need root privileges, so you can run it with any unprivileged user. First verify what time your computer thinks it is with the date command. All the computers on your LAN should be synchronized with each other, which you can do with a local NTP server:
$ date OK, the time is right, so now create your crontab. This wakes up the backup server every night at 11:30 PM. Remember to use your own server's MAC address:
$ crontab -e To save and close your new crontab, simply save and close your editor in the usual way. You'll see a confirmation like this if it is successful:
File Name to Write: /tmp/crontab.g38BLX/crontab cron uses your default editor, so if you don't like the default or don't have one, you'll have to set it according to whatever way your Linux distribution does it, which is a mess for another day.
m is minutes, 0-59 The cron daemon supplies a default environment, defining HOME, LOGNAME, SHELL (=/usr/bin/sh), and PATH (=/usr/bin). If your command or script is not in your home directory or /usr/bin/, then you need to spell out the complete filepath. Commands in your home directory can use the HOME variable, like $HOME/commandname. |