#!/bin/sh LOGDIR=/var/log/backup LOG=${LOGDIR}/last.log STAMP=`/bin/date +%y%m%d.%H%M` ERRLOG=${LOGDIR}/error.${STAMP}.log HOST=XXXXXX USER=XXXXXX export USER RSYNC_PASSWORD=XXXXXX export RSYNC_PASSWORD cd ${LOGDIR} /bin/rm -f last-7.log /bin/mv -f last-6.log last-7.log /bin/mv -f last-5.log last-6.log /bin/mv -f last-4.log last-5.log /bin/mv -f last-3.log last-4.log /bin/mv -f last-2.log last-3.log /bin/mv -f last-1.log last-2.log /bin/mv -f last.log last-1.log /usr/bin/touch ${LOG} /usr/bin/touch ${ERRLOG} /usr/bin/rsync -v --archive \ --delete-excluded --delete-before \ --whole-file \ --exclude /proc/ \ --exclude /sys/ \ --exclude /local/mercury_old/ \ \ / \ rsync://${USER}@${HOST}/mercury \ >> ${LOG} 2>> ${ERRLOG} if [ ! -s ${ERRLOG} ] ; then echo "No errors, removing error log file" >> ${LOG} rm ${ERRLOG} else echo "Error logfile left: ${ERRLOG}" >> ${LOG} fi