#!/bin/bash
BAKDIR=/root/f5backup
MONTH=`date +%m`
DAY=`date +%d`
YEAR=`date +%Y`
FNAME=$YEAR-$MONTH-$DAY
BACKUP_LOG="/root/f5backup/backup.log"
SOURCE_DIR="/var/local/ucs"
if [ -d $BAKDIR ] && [ -d $SOURCE_DIR ] ;then
b config save $FNAME
ssh logger@100.33.101.20 "[ -d /logs/f5_backup/`hostname` ] || mkdir -p /logs/f5_backup/`hostname`"
cd $SOURCE_DIR
echo "`date` F5 Increase backup start !!">>$BACKUP_LOG
find -type f -mtime -1|xargs tar zcf $BAKDIR/increase_$FNAME.tgz
scp -rp $BAKDIR/increase_$FNAME.tgz logger@100.33.101.20:/logs/f5_backup/$HOSTNAME/
echo "`date` F5 Increase backup complete !!" >>$BACKUP_LOG
fi
find  /root/f5backup/ -name "increase*.tgz" -type f -mtime +3 -exec rm {} \;
find  /var/local/ucs/ -name "*-*-*.ucs" -type f -mtime +3 -exec rm {} \;