SYNCLOGFILE="/var/log/rsync-201.log" SYNCLOCKFILE="/var/lock/rsync-201.lock" if [[ -f $SYNCLOCKFILE ]]; then # lock file already present, bail exit 1 fi echo -n ">>> Sync log for " >> $SYNCLOGFILE date >> $SYNCLOGFILE touch $SYNCLOCKFILE rsync -vzrtopg --delete 192.168.0.201::www /backup >> $SYNCLOGFILE 2>&1 rm -f $SYNCLOCKFILE