Notepad:crontab

From Amar
Jump to navigationJump to search

Schedule crontab with locks

 if [ -d ${SOURCE} ]; then
 if [ -d ${DEST} ]; then
 (
  /usr/bin/flock -x -w 10 200 || exit 1
  /usr/bin/rsync -aq --delete-after ${SOURCE} ${DEST}.
 ) 200>/var/lock/.svnbackup.exclusivelock
 else
     echo "Dest dir $DEST doesn't exist"
 fi
 else
     echo "Source dir $SOURCE doesn't exist"
 fi