2008-04-15

An idea for a critical file archive script

I am sure most of us have various critical files strewn about our systems that we would like to see backed up and accessible almost anywhere. I know in my case I have SSH keys, GPG keys, zsh configuration files, etc. This is stuff that I REALLY do not want to lose AND I would like to have available to me on any machine with a Net connection.

I could keep a bash script or something to collect these various files, zip them up, and then scp them to various machines I have about the Net. But I hate bash scripts. And if I want any form of intelligence or nice features then a shell script just ain't going to cut it. I could use rsync by having one file list all the files I care about and then another that listed all the servers to rsync to, but I would still need to deal with the file renamings if I wanted that (symlinks could work to solve that issue).

My thinking is to have a simple configuration file that uses ConfigParser. Sections would represent subdirectories in the archive. Keys in each section represent files that are to end up in the subdirectory (directories themselves represent the directory specified). And value is to stand for a possible rename of the file itself (e.g., so that configuration files with a leading dot can skip that in the archive and thus easily be viewed). Obviously nothing complex:
[ZSH]
~/.zshrc = zshrc

[SSH]
~/.ssh/id_dsa =
Could even go as far as having a configuration section to specify the archive file name, format, and servers to upload the file to.

But perhaps having a backup directory that has symlinks for the desired renaming and then use rsync to deal with the uploading might be the simplest solution.