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.
- 1Linux Top 3: Fedora 24, Peppermint 7 and Solus 1.2
- 2Linux Top 3: Alpine Linux 3.4, deepin 15.2 and Linux Lite 3.0
- 3Linux 4.7 Set to Boost Live Patching, Security and Power Management
- 4Linux 4.6 Charred Weasel adds USB 3.1 Support
- 5Linux Top 3: OpenIndiana 2016.04, Ubuntu 16.04 and Debian's New Leader