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