Advertisement
freephile

track "outside" content with etckeeper

Oct 2nd, 2013
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.19 KB | None | 0 0
  1. vim /etc/etckeeper/commit.d/20mirror-outside-files
  2.  
  3. #!/bin/sh
  4. set -e
  5.  
  6. # Greg Rundlett info@equality-tech.com
  7. # based on code from http://serverfault.com/questions/211425
  8.  
  9. # If you want other configuration data or files on the system also
  10. # opportunistically tracked via etckeeper, use this script to copy them in.
  11.  
  12. # If there is a hook of some sort available related to the files
  13. # you're mirroring, (e.g. Apache restart for CSVN)
  14. # you can call etckeeper directly and track them
  15. # proactively, rather than just opportunistically here.
  16.  
  17. MIRROR_ROOT=/etc/etckeeper.mirror.d
  18. echo "etckeeper: mirroring outside files to $MIRROR_ROOT/:"
  19.  
  20. mirror_dir() {
  21.    LOCAL_PATH=$1
  22.    echo "  $LOCAL_PATH"
  23.    mkdir -p $MIRROR_ROOT/$LOCAL_PATH
  24.    rsync -a $LOCAL_PATH/ $MIRROR_ROOT/$LOCAL_PATH
  25. }
  26.  
  27. mirror_file() {
  28.    LOCAL_PATH=$1
  29.    DIRPATH=`dirname $LOCAL_PATH`
  30.    echo "  $LOCAL_PATH"
  31.    mkdir -p $MIRROR_ROOT/$DIRPATH
  32.    rsync -a $LOCAL_PATH $MIRROR_ROOT/$DIRPATH
  33. }
  34.  
  35. ###########################################
  36. ## ADD lines below to invoke the system ###
  37. ###########################################
  38.  
  39. mirror_file "/var/www/html/wiki/LocalSettings.php"
  40. mirror_dir "/usr/local/csvn/data/conf"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement