|
Aug 04, 2007 at 08:12 PM |
|
Page 1 of 4 This is a backup script I created for my own personal use. It serves my purposes and hopefully you will find it useful and/or educational.
The package includes the script itself, a configuration file, and an ignore list. It is meant to be called from a cron job and backup files to a remotely mounted file system. It would also be possible to use the script in the reverse situation, running the script on the storage pc and backing up contents of a remote file system.
There are some configuration settings in the script that must be initially set to get the script to work correctly. Comments on these settings can be found in the script itself. These settings will someday be split out into a config file.
The configuration file allows you to configure what is backed up. The format is fairly flexible, and with a little creativity it should allow you to do most of what you want. The format of the config file can be found in backup.conf
Each filename is checked against ignorelist before backup. If the filename and/or path contains any entry in the ignore list, that file is not backed up. Be careful with this as it is very easy to get undesired effects, and very difficult to catch problems with this until it is too late.
To set this backup in cron:
Edit your cron jobs: crontab -e
Here is the contents of my crontab:
45 3 2 */3 * /var/backup/backup 0 45 2 3,17 * /var/backup/backup 1 00 3 * * 1,4 /var/backup/backup 2
This will run a full backup at 3:45am on the 2nd day of every 3rd month, A differential backup at 2:45am on the 3rd and 17th of each month, and an incremental backup at 3:00am on Monday and Thursday. More information on the format can be found in the manual page for the crontab file "man 5 crontab". Remember that the optimal backup schedule depends greatly on the data's importance, size, and frequency of change, so your schedule may vary greatly.
This script is released to the public domain and you are free to do with it what you wish.
Created by byronholldorf2{at}yahoo{dot}com
|