Annotation of sludge_scripts/backup.sh, revision 1.3

1.1       nick        1: #!/bin/bash
                      2: 
1.3     ! nick        3: VERSION="$Id$"
1.1       nick        4: REMOTE="nick@demandred.dyndns.org"
                      5: OPTIONS="-avxz -e ssh --delete"
                      6: LOGDIR=/home/backup/logs
                      7: DATE=`date +%Y%m%d`
                      8: 
1.3     ! nick        9: 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 )
        !            10: 
        !            11: WINSHARE_DIRS=( /home/winshare/Documents /home/winshare/Pictures /home/winshare/Receipts "/home/winshare/Shared Docs" /home/winshare/Backgrounds )
1.1       nick       12: 
                     13: 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)
                     14: 
                     15: [ -d $LOGDIR ] || mkdir -p $LOGDIR
                     16: 
                     17: cd /home/backup/backups
                     18: 
1.3     ! nick       19: for bdir in demandred winshare lanfear;
        !            20: do
        !            21:        [ "$bdir" == "demandred" ] && DIRS=(${DEMANDRED_DIRS[@]})
        !            22:        [ "$bdir" == "winshare" ]  && DIRS=(${WINSHARE_DIRS[@]})
        !            23:        [ "$bdir" == "lanfear" ]   && DIRS=(${LANFEAR_DIRS[@]})
        !            24:        mkdir -p $bdir
        !            25:        cd $bdir
        !            26:        for DIR in "${DIRS[@]}"; do
        !            27:                /usr/bin/rsync $OPTIONS $REMOTE:$DIR . >> $LOGDIR/backup-$DATE.log 2>&1
        !            28:        done
        !            29:        cd - > /dev/null 2>&1
1.1       nick       30: done
                     31: 
                     32: ##
                     33: ## Compress logs after 5 days and delete logs after 6 months
                     34: ##
                     35: find $LOGDIR -type f -name \*.gz -mtime +180 -exec rm -f {} \;
                     36: find $LOGDIR -type f -name \*.log -mtime +5 -exec gzip -9 {} \;

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