Created
July 13, 2014 13:17
-
-
Save Laurian/bbd23440cc04b3ba6b2d to your computer and use it in GitHub Desktop.
20mirror-outside-files
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/sh | |
set -e | |
# Based on nealmcb's + ErebusBat's script from http://serverfault.com/questions/211425/ | |
# If you want other configuration data or files on the system also | |
# opportunistically tracked via etckeeper, use this script to copy them in. | |
# If there is a hook of some sort available related to the files | |
# you're mirroring, you can call etckeeper directly and track them | |
# proactively, rather than just opportunistically here. | |
MIRROR_ROOT=/etc/etckeeper.mirror.d | |
echo "etckeeper: mirroring outside files to $MIRROR_ROOT/:" | |
mirror_dir() { | |
LOCAL_PATH=$1 | |
echo " $LOCAL_PATH" | |
mkdir -p $MIRROR_ROOT/$LOCAL_PATH | |
rsync -a $LOCAL_PATH/ $MIRROR_ROOT/$LOCAL_PATH | |
} | |
mirror_file() { | |
LOCAL_PATH=$1 | |
DIRPATH=`dirname $LOCAL_PATH` | |
echo " $LOCAL_PATH" | |
mkdir -p $MIRROR_ROOT/$DIRPATH | |
rsync -a $LOCAL_PATH $MIRROR_ROOT/$DIRPATH | |
} | |
#mirror_file "/var/srv/foo_bar/blog/config.py" | |
#mirror_file "/var/srv/foo_bar_another_host/trac/conf/trac.ini" | |
mirror_file "/home/ubuntu/.bash_history" | |
#mirror_file "/root/.bash_history" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment