Diff for /sludge_scripts/backup.sh between versions 1.2 and 1.5

version 1.2, 2011/06/07 13:01:03 version 1.5, 2011/06/17 16:36:20
Line 1 Line 1
 #!/bin/bash  #!/bin/bash -x
   
   VERSION="$Id$"
 REMOTE="nick@demandred.dyndns.org"  REMOTE="nick@demandred.dyndns.org"
 OPTIONS="-avxz -e ssh --delete"  OPTIONS=-avxz -e ssh --delete
 LOGDIR=/home/backup/logs  LOGDIR=/home/backup/logs
 DATE=`date +%Y%m%d`  DATE=`date +%Y%m%d`
   
 DIRS=( /home/nick/database-backup.dump.gz /home/nick/database-backup.dump.yesterday.gz /home/nick/DroidBackups /home/winshare/Pictures /home/cvs /home/nick/bbs /home/nick/notes /home/httpd /home/nick/Documents /home/nick/mail /home/nick/mail-backup /home/winshare/Documents )  DEMANDRED_DIRS=( /home/nick/database-backup.dump.gz /home/nick/database-backup.dump.yesterday.gz /home/nick/DroidBackups /home/cvs /home/nick/bbs /home/nick/notes /home/httpd /home/nick/Documents /home/nick/mail /home/nick/mail-backup )
   
   WINSHARE_DIRS=( /home/winshare/Documents /home/winshare/Pictures /home/winshare/Receipts "/home/winshare/Shared Docs" /home/winshare/Backgrounds )
   
 LANFEAR_DIRS=(/home/backup/systems/lanfear/home/nick/Documents /home/backup/systems/lanfear/home/nick/Receipts "/home/backup/systems/lanfear/home/nick/Nick\'s Pictures" /home/backup/systems/lanfear/home/nick/projects /home/backup/systems/lanfear/home/nick/notes)  LANFEAR_DIRS=(/home/backup/systems/lanfear/home/nick/Documents /home/backup/systems/lanfear/home/nick/Receipts "/home/backup/systems/lanfear/home/nick/Nick\'s Pictures" /home/backup/systems/lanfear/home/nick/projects /home/backup/systems/lanfear/home/nick/notes)
   
 [ -d $LOGDIR ] || mkdir -p $LOGDIR  [ -d $LOGDIR ] || mkdir -p $LOGDIR
   
 cd /home/backup/backups  cd /home/backup/backups
 mkdir -p demandred  
 cd demandred  
 for DIR in "${DIRS[@]}"; do  
         /usr/bin/rsync $OPTIONS $REMOTE:$DIR . >> $LOGDIR/backup-$DATE.log 2>&1  
 done  
 cd - > /dev/null 2>&1  
   
 mkdir -p lanfear  SAVEIFS=$IFS
 cd lanfear  for bdir in demandred winshare lanfear;
 for DIR in "${LANFEAR_DIRS[@]}"; do  do
         /usr/bin/rsync $OPTIONS $REMOTE:$DIR . >> $LOGDIR/backup-$DATE.log 2>&1          IFS=$(echo -en "\n\b")
           [ "$bdir" == "demandred" ] && DIRS=(${DEMANDRED_DIRS[@]})
           [ "$bdir" == "winshare" ]  && DIRS=(${WINSHARE_DIRS[@]})
           [ "$bdir" == "lanfear" ]   && DIRS=(${LANFEAR_DIRS[@]})
           mkdir -p $bdir
           cd $bdir
           for DIR in "${DIRS[@]}"; do
                   /usr/bin/rsync $OPTIONS $REMOTE:$DIR . >> $LOGDIR/backup-$DATE.log 2>&1
           done
           cd - > /dev/null 2>&1
 done  done
 cd - > /dev/null 2>&1  IFS=$SAVEIFS
   
 ##  ##
 ## Compress logs after 5 days and delete logs after 6 months  ## Compress logs after 5 days and delete logs after 6 months

Removed from v.1.2  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>