Annotation of sludge_scripts/backup.sh, revision 1.7

1.6       nick        1: #!/bin/bash
1.1       nick        2: 
1.7     ! nick        3: declare VERSION="$Id$"
1.6       nick        4: declare LOGDIR="/home/backup/logs"
                      5: declare SCRIPT="/home/backup/scripts/backup.pl"
                      6: declare DATE=`date +%Y%m%d`
1.1       nick        7: 
                      8: [ -d $LOGDIR ] || mkdir -p $LOGDIR
                      9: 
1.6       nick       10: [ -x $SCRIPT ] || \
                     11: {
                     12:        echo "ERROR: Missing $SCRIPT"
                     13:        exit 1
                     14: }
1.1       nick       15: 
1.6       nick       16: ##
                     17: ## Call our perl script to handle the dirty work
                     18: ##
                     19: $SCRIPT $LOGDIR >> $LOGDIR/backup-$DATE.log 2>&1
1.1       nick       20: 
                     21: ##
                     22: ## Compress logs after 5 days and delete logs after 6 months
                     23: ##
                     24: find $LOGDIR -type f -name \*.gz -mtime +180 -exec rm -f {} \;
                     25: find $LOGDIR -type f -name \*.log -mtime +5 -exec gzip -9 {} \;

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