#!/bin/sh ###################################################################### # tirsync - Synchronize Tears in Rain master and local mirror data sets. # Created 2006-09-21 by David Meyer. ###################################################################### # Identification ##################################################### PROGRAM='tirsync (Tears in Rain)' VERSION=0.0 COPYRIGHT='Copyright (C) 2006 David Meyer' DESCRIPTION='Synchronize Tears in Rain master and local mirror data sets.' USAGE="Usage: $0 [-Vh] [get|put]" CONTACT='David Meyer <papa@jtan.com>' # Initialize environment ############################################# unset IFS PATH= ECHO=/bin/echo CAT=/bin/cat RSYNC=/usr/bin/rsync RSH=/usr/bin/ssh MASTER=papa@callisto.jtan.com:public_html/Meyer21C/ LOCAL=/mnt/card/Meyer21C/ OPTIONS='-urptlzv --stats --progress --delete' # Arguments ########################################################## while getopts Vh option do case $option in V ) $ECHO "$PROGRAM $VERSION" $ECHO $COPYRIGHT exit 0 ;; h ) $CAT << ENDHELP $USAGE $DESCRIPTION Options: -V Display version number -h Display this help message get Download from master to local data set files not found in local data set or more recently updated than corresponding member of local set, delete local files not found in master data set. put Upload files from local data set not found in master or more recently updated than corresponding member of master data set, delete master files not found in local data set. Report bugs to $CONTACT. ENDHELP exit 0 ;; * ) $ECHO $USAGE >&2 exit 1 ;; esac done shift $(( $OPTIND-1 )) COMMAND=$1 # Functions ########################################################## # Main driver ######################################################## if [ x"$COMMAND" = x"get" ] then $RSYNC -e$RSH $OPTIONS $MASTER $LOCAL elif [ x"$COMMAND" = x"put" ] then $RSYNC -e$RSH $OPTIONS $LOCAL $MASTER else $ECHO $USAGE >&2 fi exit 0