Unattended Linux Wakeup, Backup, Shutdown (part 5)
The Master Plan, Cron Wakeups
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:
- Since I have a router that runs 24x7, that runs a cron job that wakes up the backup server. The wakeup command can be run from any computer on the same subnet as the server.
- Each client PC has its own backup script, also started by cron.
- Server and clients all have their own cron jobs to shut them off.
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:
Tue Mar 1 13:58:21 PST 2011
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
# m h dom mon dow command
30 23 * * * /usr/bin/wakeonlan -p 8 00:0H:34:15:CD:92
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
crontab: installing new 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
h is hour, 0-23
dom is day of month, 1-31
mon is month, 1-12
dow is day of week, 0- 6 Sunday through Saturday
command is the command or script you want to run
Asterisk means every day, month, or day of week.
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.
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: Linux 3.11, Kubuntu Goes Commercial
- 5Linux Top 3: RHEL 6.5, Debian 7.2 and EOL for Linux 3.0.x