All pastes #2122018 Raw Edit

Anonymous

public shellscript v1 · immutable
#2122018 ·published 2012-02-27 12:56 UTC
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 "$@"