#!/bin/bash # # Synchronizes mirrors, pushing file copies out to remote host $1. # # Might also pull a few copies in, rather than push, # in cases where this host is the sole destination. # if [ ! $1 ]; then echo "no host specified" exit 1 fi mountpoint=/mnt/lan/$1 if ! egrep --quiet " $mountpoint " /etc/mtab; then mount $mountpoint || exit 1 was_mounted_here=1 fi umask 0222 # force read-only (no point editing copies -- edit originals) dir='/etc/skel.link' echo; echo $dir; echo '--------------------'; rsync --group --owner --perms --recursive --temp-dir=/tmp --times --verbose \ --include="/.emacs" \ --include="/.toprc" \ --exclude="*" \ $dir/ /mnt/lan/$1$dir/ dir='/home/mike' if [ $1 != slim ]; then # slim mounts home on a separate partition echo; echo $dir; echo '--------------------'; ## --recursive needed in following selective ones, or they skip root dir itself (a "/*" at end does not help), and there appears to be no way to include the root [I thought I had something working in cracker/sync] rsync --group --owner --perms --recursive --temp-dir=/tmp --times --verbose \ --include="/.keystore" \ --exclude="*" \ $dir/ /mnt/lan/$1$dir/ fi dir='/usr/local/bin' echo; echo $dir; echo '--------------------'; rsync --group --owner --perms --recursive --temp-dir=/tmp --times --verbose \ --include="/collapse-bash-history" \ --include="/is-text" \ --include="/noss" \ --include="/strip-cr" \ --include="/strip-cr-file" \ --exclude="*" \ $dir/ /mnt/lan/$1$dir/ if [ $1 == ivory ]; then rsync --group --owner --perms --recursive --temp-dir=/tmp --times --verbose \ --include="/vox-*" \ --exclude="*" \ $dir/ /mnt/lan/$1$dir/ fi if [ $1 == slim ]; then rsync --group --owner --perms --recursive --temp-dir=/tmp --times --verbose \ --exclude="/desk-launch" \ --exclude="/sync-to" \ --exclude="/sync-web" \ --exclude="/tail-all" \ $dir/ /mnt/lan/$1$dir/ fi dir='/usr/local/libexec' echo; echo $dir; echo '--------------------'; rsync --group --owner --perms --recursive --temp-dir=/tmp --times --verbose \ --include="/jar-wrapper" \ --exclude="*" \ $dir/ /mnt/lan/$1$dir/ if [ $1 == slim ]; then dir='/usr/local/lib' echo; echo $dir; echo '--------------------'; rsync --group --owner --perms --recursive --temp-dir=/tmp --times --verbose \ --exclude="/site_perl/._" \ --exclude="/site_perl/Zelea/Desktop.pm" \ $dir/ /mnt/lan/$1$dir/ dir='/home/mike/project/textbender' # separate from above, othrewise rsync's --copy-links etc. are flakey echo; echo $dir; echo '--------------------'; rsync --group --owner --perms --recursive --temp-dir=/tmp --times --verbose --copy-links --delete-excluded \ $dir/ /mnt/lan/$1/usr/local/lib/site_perl/textbender/ dir='/usr/local/libexec' echo; echo $dir; echo '--------------------'; rsync --group --owner --perms --recursive --temp-dir=/tmp --times --verbose \ $dir/ /mnt/lan/$1$dir/ dir='/usr/local/share/emacs' echo; echo $dir; echo '--------------------'; rsync --group --owner --perms --recursive --temp-dir=/tmp --times --verbose \ $dir/ /mnt/lan/$1$dir/ dir='/usr/lib/foxrc' echo; echo $dir; echo '--------------------'; rsync --group --owner --perms --recursive --temp-dir=/tmp --times --verbose \ --exclude="/Desktop-example" \ $dir/ /mnt/lan/$1$dir/ fi umask 0333 # force read-only, force non-executable if [ $1 == ivory ]; then dir="$1/etc" echo; echo $dir; echo '--------------------'; rsync --copy-links --delete-excluded --group --owner --perms --recursive --temp-dir=/tmp --times --verbose \ --include="/tomcat-6/" \ --include="/tomcat-6/Catalina/" \ --include="/tomcat-6/Catalina/t.zelea.com/" \ --include="/tomcat-6/Catalina/t.zelea.com/_autoindex-summary.html" \ --include="/tomcat-6/Catalina/t.zelea.com/v.xml" \ --include="/tomcat-6/context.xml" \ --include="/tomcat-6/logging.properties" \ --include="/tomcat-6/server.xml" \ --include="/tomcat-6/web.xml" \ --include="/votorola.js" \ --exclude="*" \ /mnt/lan/$dir/ /home/mike/system/host/$dir/ dir="$1/home/tester" echo; echo $dir; echo '--------------------'; rsync --copy-links --delete-excluded --group --owner --perms --recursive --safe-links --temp-dir=/tmp --times --verbose \ --include="/.java/" \ --include="/.java/logging.properties" \ --include="/.qmail*" \ --include="/.tmda/" \ --include="/.tmda/config" \ --include="/.tmda/filters**" \ --include="/.tmda/templates**" \ --include="/system**" \ --include="/votorola**" \ --exclude="*" \ /mnt/lan/$dir/ /home/mike/system/host/$dir/ dir="$1/home/v" echo; echo $dir; echo '--------------------'; rsync --copy-links --delete-excluded --group --owner --perms --recursive --safe-links --temp-dir=/tmp --times --verbose \ --include="/.java/" \ --include="/.java/logging.properties" \ --include="/.qmail*" \ --include="/.tmda/" \ --include="/.tmda/config" \ --include="/.tmda/filters**" \ --include="/.tmda/templates**" \ --include="/system**" \ --include="/votorola**" \ --exclude="*" \ /mnt/lan/$dir/ /home/mike/system/host/$dir/ dir="$1/opt/jdk/jre/lib" echo; echo $dir; echo '--------------------'; rsync --delete-excluded --dirs --group --owner --perms --temp-dir=/tmp --times --verbose \ --include="/java-logging.properties" \ --exclude="*" \ /mnt/lan/$1/opt/ /home/mike/system/host/$dir/ dir="$1/usr/local/bin" echo; echo $dir; echo '--------------------'; rsync --delete-excluded --group --owner --perms --recursive --temp-dir=/tmp --times --verbose \ --include="/hombak" \ --include="/is-spam*" \ --include="/qlog-*" \ --include="/sa-update*" \ --include="/sysbak-*" \ --include="/t-*" \ --include="/vox-*" \ --exclude="*" \ /mnt/lan/$dir/ /home/mike/system/host/$dir/ dir="$1/var/qmail/alias" echo; echo $dir; echo '--------------------'; rsync --copy-links --delete-excluded --group --owner --perms --recursive --temp-dir=/tmp --times --verbose \ --include="/.qmail-city-default" \ --include="/.qmail-electoral-service" \ --include="/.qmail-register" \ --include="/.qmail-test-default" \ --include="/.qmail-trinity-default" \ --include="/.qmail-ward-default" \ --exclude="*" \ /mnt/lan/$dir/ /home/mike/system/host/$dir/ fi [ $was_mounted_here ] && umount $mountpoint