Search:

Example Two - Creating /etc Backups

The second example is about something more pratical. Modern Linux'es have all their important files under the /etc directory tree. Since we are going to access the /etc files you should become root.

backup-etc is a simple shell script that archves the /etc directory tree under /var/backup/etc (the directory is created if it does not exists). The script can be called without any other preparation or command line parameters. On my system I get

# ./backup-etc
0007 0007-20060105
wcp: ignoring file 40 Colors

This shows two things. First this is the 7th backup I'm doing on my system. Second wcp ignores files that have blanks in their names, in this example "40 colors" which is a file in the directory /etc/kde/colors. This is a limitation I will perhaps remove in a later version, but for now it's simply like that.

Since wcp is run as root, the server space is local and hence wcpd runs also as root, the archive features differ from archive made as non-superuser.

Creating local /etc backups protects you against configuration or handling mistakes but not agaist disk crashes, for this backups to another server are required. Remote can be done with a command like

# wcp store /etc ssh://root@backup-server/var/backups/$HOSTNAME

which arcives the local /etc tree on backup-server under /var/backups.

Since wcp does not store any local information, you can also mix local and remote backups. The files that have to be copied to the server depend only on the last archive version on the destination. Or in other words

wcp can archive to different server locations.

It's especially possible to mix e.g. manual local and automatic remote archive runs, wcp knows which files to copy. See "Example Four - Running a Central Backup Server" for more information about remote backups.

backup-etc supports the following command line options.

-n label
append label to the automatic generated version name which is 4 digit version number followed by the current date.

-s server
select another server locataion than the default /var/backup/etc.

-- options
Options following two dashes are passed as options to wcp's store operation.

backup-etc's default server location may be set in it's default file /etc/default/backup-etc.