You are here

Use bzr to backup & track system configurations changing history

It's very important to keep a backup of system configuration files, and it's more useful if we can track it's changing history. I don't know if there has any traditional backup solution, but at least bzr(bazaar) or other modern DVCS like hg(mercurial) did it well.
My backup script:
---------------------------------------------------------------
#!/bin/sh

echo "Start backup /etc"

base_dir=~/backup/jianyu.net/etc

rsync -av --delete --exclude '.bzr' /etc/ $base_dir

cd $base_dir

bzr commit -m "Changes made before $(date +%Y-%m-%d_%H:%M:%S)"

result=$?

echo "Result code: $result"

exit $result
---------------------------------------------------------------
Next thing is to put this script into crontab, now I didn't have to worried about forgotten made a backup.