Unattended Linux Wakeup, Backup, Shutdown (part 5) - page 2
The Master Plan, Cron Wakeups
Cron Shutdown
This 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
/etc/crontab is fast and easy, and it has an extra field for the user. Just edit it like you would any text configuration file. shutdown -h +5 means poweroff after a five-minute warning, in case anyone is still working.
Scheduling Backups
Each 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.Resources
Always remember the excellent man pages:man rsync
man crontab
man wakeonlan
man shutdown
man ssh
man sshd
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.
- Skip Ahead
- 1. The Master Plan, Cron Wakeups
- 2. The Master Plan, Cron Wakeups
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.