Automatic Linux Laptop Backups
Anacron Saves the Day
cron is great for servers and desktops that are always on, but if you want to schedule a backup (or indeed any other job) on a laptop or other machine that may not always be on, try anacron instead.
The main downside of anacron is that you can run it only at intervals of one or more days. cron, on the other hand, can be run at intervals as small as one minute. For most backup schedules, this won't be a problem.
A further issue is that anacron can be configured only by the root user, whereas cron can be used by anyone. Again, this is unlikely to be a problem for laptop backup.
To set up an rsync backup for your laptop, edit the file/etc/anacrontab, as root, and add the following single line:
1 5 backup rsync -auz -e "ssh -i /home/user/.ssh/rsync" /test email@example.com:/home/user/backup
This line will run the given rsync command every day (the first parameter) with a delay of five minutes (the second parameter) and identify the job in logs as 'backup' (the third parameter). As with cron, anything after the time and log parameters is assumed to be part of the command to be run.
This tip is taken from my current book, Linux System Administration Recipes. Check it out for more sysadmin hints and tips.
Juliet Kemp has been messing around with Linux systems, for financial reward and otherwise, for about a decade. She is also the author of "Linux System Administration Recipes: A Problem-Solution Approach" (Apress, 2009).
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: RHEL 6.7, BackBox Linux 4.3 and RoboLinux 8.1
- 2Linux Top 3: SLES 11 SP4, Chromixium OS 1.5 and Canonical Licensing
- 3Linux Top 3: VirtualBox 5, Point Linux 3.0 and OpenSUSE Leap 42.x
- 4Linux Top 3: Linux 4.2 rc1, 4MLinux 13 and antiX15
- 5Linux Top 3: Linux Mint Rafaela, OpenMandriva Lx 2014.2 and VectorLinux 7.1