HowTo Make & Schedule Daily & Weekly Backup Scripts
General Overview




General Overview:

Expectations / Requirements:

This HowTo requires that you have a general knowledge of FreeBSD or another Unix based O/S and writing and executing shell scripts.

What To Backup & How Often:

This depends mainly on personal preference, what the system is being used for, and the backup medium used (file on hard drive in this example). The following examples that I use in this HowTo were written for a FreeBSD 4.3-RELEASE machine that was running an Apache Web server, a DNS server, a samba server, and MySQL server. You need to look at these running applications / services and then decide which files for each of these need to be backed up, and at what frequency.

For Example, my Mysql Server runs my guestbook, and an online directory for my fraternity brothers. What all of this has to do with the backups, is simple the files change often. The /mysql directory (where my database files are stored) is a good examples of files that you would want to backup in a daily backup. Of course not all of the files change in the /mysql directory, but they are not large enough to make it worth the effort of adding the files we want to backup individually to keep from backing up the files that don't change regularly. Other files that I chose to backup daily include /usr/local/etc/samba.conf (samba configuration file, contains share definitions), /etc/master.passwd, /etc/passwd. There are more that I include in the example, however, they will likely not change often normally, I wrote the example scripts while still in the process of setting up the machine, so I am backing up some files more frequently than I will later when the system is in full use (It is the system you are currently viewing this web page from).

This is a fairly limited number of files, and will no way enable me to restore an entire system, but will allow me to restore say a configuration file, that no longer works, due to an editing mistake, or accidentally deleting it, I use the root login more than anyone ever should. Also since I don't have a tape drive, and don't want to use too much hard drive space to store old backups, I wanted the backups to be just what I needed. If you have a tape drive, you may want to backup considerably more on a daily basis depending on the speed and size of your tape drive, and the number of tapes you have available. Especially if your system has users regularly accessing it, and saving files in their home directories.

To decide what to put in the weekly backup, you simply look at what you backed up in your daily backup, then add the files that will change less often. For example, I added the Apache Web Document Root to my weekly, along with more configuration files that I don't change as often.