diff --git a/mirror/files/sync-mirrors b/mirror/files/sync-mirrors index fa8c237..28a4d82 100755 --- a/mirror/files/sync-mirrors +++ b/mirror/files/sync-mirrors @@ -27,12 +27,13 @@ else fi VERBOSE=0 +NOOP="" EXTRA_OPTS="" -while getopts "vhl" c ; do +while getopts "vhln" c ; do case $c in v) VERBOSE=1 - EXTRA_OPTS="-v --progress" + EXTRA_OPTS="${EXTRA_OPTS} -v --progress" ;; h) usage @@ -45,6 +46,10 @@ while getopts "vhl" c ; do done exit 0 ;; + n) + NOOP=" (DRY RUN)" + EXTRA_OPTS="${EXTRA_OPTS} -n" + ;; esac done @@ -98,7 +103,7 @@ for mirror in ${SYNC} ; do echo "ERR: No SRC set for mirror ${mirror} ..." 1>&2 exit 1 fi - logmsg "Starting ${mirror} sync ..." + logmsg "Starting ${mirror} sync${NOOP}..." rsync -aH -4 ${EXTRA_OPTS} --numeric-ids --delete --delete-delay \ --delay-updates --no-motd ${RSYNCOPTS} --log-file=${LOGFILE} \ --exclude=.~tmp~/ ${SRC} /srv/mirrors/${mirror}/ @@ -106,7 +111,7 @@ for mirror in ${SYNC} ; do if [ ${STATUS} -ne 0 ]; then echo "WARN: Encountered errors on ${mirror} sync, see ${LOGFILE} for details" 1>&2 fi - logmsg "Finished ${mirror} sync with exit status ${STATUS} ..." + logmsg "Finished ${mirror} sync with exit status ${STATUS}${NOOP} ..." if [ "${POSTCMD}" != "" ]; then logmsg "Running post for ${mirror} ..." ${POSTCMD} 2>&1 | awk \