Unattended Linux Wakeup, Backup, Shutdown (part 5) - page 2
The Master Plan, Cron Wakeups
Cron ShutdownThis goes on each individual computer in the /etc/crontab file, shutting them down at 12:30 AM:
# m h dom mon dow user command
30 00 * * * root /sbin/shutdown -h +5
Scheduling BackupsEach client computer run its own backup script from cron. There are a half-dozen PCs on my little LAN, and I schedule them to start five minutes apart. Run crontab -e for each user and create an entry like this:
# m h dom mon dow command
40 23 * * * $HOME/backup_script
When you're testing cron jobs, schedule them a minimum of two minutes into the future or they won't run.
Don't Use Rsync!Every time I write about rsync backups readers write to me suggesting that the simple rsync mirroring I use is not adequate, and I should be using incremental backups for each day of the week, or versioned backups, or compressed using tar, or something else that is more complicated. Use whatever suits your needs; I keep it simple to keep these articles from growing out of control, and I think incremental backups and snapshots are oversold for user data backups. rdiff-backup and rsnapshot are good tools for incremental backups, and rsync can also make these with a bit of scripting. You can find good examples all over the place. Any of these can be tailored to suit your needs and incorporated into this splendid hands-off backup regime.
ResourcesAlways remember the excellent man pages:
My own Linux Cookbook has chapters on rsync and running a local NTP server.
SSH, The Secure Shell: The Definitive Guide (O'Reilly Media) is a great guide to learning the many things that OpenSSH can do. A must-have for all Linux admins.
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 Linux Planet and Linux Today.