File:  [Local Repository] / sludge_scripts / backup.sh
Revision 1.7: download - view: text, annotated - select for diffs
Thu Jun 23 13:32:48 2011 UTC (13 years, 4 months ago) by nick
Branches: MAIN
CVS tags: HEAD
Fixed stupid mistakes.

#!/bin/bash

declare VERSION="$Id: backup.sh,v 1.7 2011/06/23 13:32:48 nick Exp $"
declare LOGDIR="/home/backup/logs"
declare SCRIPT="/home/backup/scripts/backup.pl"
declare DATE=`date +%Y%m%d`

[ -d $LOGDIR ] || mkdir -p $LOGDIR

[ -x $SCRIPT ] || \
{
	echo "ERROR: Missing $SCRIPT"
	exit 1
}

##
## Call our perl script to handle the dirty work
##
$SCRIPT $LOGDIR >> $LOGDIR/backup-$DATE.log 2>&1

##
## Compress logs after 5 days and delete logs after 6 months
##
find $LOGDIR -type f -name \*.gz -mtime +180 -exec rm -f {} \;
find $LOGDIR -type f -name \*.log -mtime +5 -exec gzip -9 {} \;

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