Last active
November 24, 2016 02:15
-
-
Save furlongm/9cd0e0ea57a5acfc680b749d2b13e4ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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