archive_sql_log.sh

#!/bin/bash
DATE=`date +’%Y-%m-%d’`

cd /home/log/sql
FILE=`ls –ignore=”sqltime_$DATE.log” –ignore=”sqlcount_$DATE.log” –ignore=”tar_log.sh” –ignore=”*.tar.gz”`
for i in $FILE
do
tar -czf $i.tar.gz $i –remove-files
done

cd /home/log
FILE=`ls *.log`
for i in $FILE
do
tar -czf $i.tar.gz $i –remove-files
done

发表评论