rendered paste body#!/bin/shPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbinLOCK=/var/run/rsync/mirror.lockTIMER=/var/run/rsync/mirror.timerRSYNCLOG=/var/log/rsync/rsync.mirror.logRSYNCSRC=ftp.somedomain.org::ftpRSYNCDST=~ftp/pub/mirrorINTERVAL=3600update() { DATESTART=`date +%s` [ -f ${TIMER} ] && read LASTRUN < ${TIMER} || LASTRUN=0 if [ ${LASTRUN} -ge 0 -a $(( ${DATESTART} - ${LASTRUN} )) -ge ${INTERVAL} ]; then rsync -vaHAXs --log-file=${RSYNCLOG} --delete-after ${RSYNCSRC} ${RSYNCDST} && date +%s > ${TIMER} fi}[ "$1" != update ] && exec lockf -s -t 0 ${LOCK} sh $(realpath $0) updateshift && update "$@"