Skip to content

Instantly share code, notes, and snippets.

@furlongm
Last active November 24, 2016 02:15
Show Gist options
  • Save furlongm/9cd0e0ea57a5acfc680b749d2b13e4ca to your computer and use it in GitHub Desktop.
Save furlongm/9cd0e0ea57a5acfc680b749d2b13e4ca to your computer and use it in GitHub Desktop.
#!/bin/bash -e
PATH=/usr/bin:/usr/sbin:/bin:/sbin
hostname=`hostname -f`
# /var/lib/backups can be e.g. NFS mounted
backup_dir=/var/lib/backups/etc/${hostname}/
if [ ! -d /etc/.git ] ; then
apt-get -y install etckeeper git rsync
sed -i -e "s/^VCS.*/VCS=git/" /etc/etckeeper/etckeeper.conf
etckeeper init
fi
mkdir -p ${backup_dir}/etc
rsync --quiet -avh --delete --delete-after /etc/ ${backup_dir}/etc/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment