本文共 675 字,大约阅读时间需要 2 分钟。
#/bin/sh
#add by zhoujf.free log file;
DIR_LIST="/product1/port/bin/ocs_subscriber_import/back"
LOG_LIST="*201*.unl"
GZ_DAY=3
DEL_DAY=30CORE_DAY=7CUR_TIME=`date +"%Y%m%d %T"`
echo "START AT [$CUR_TIME]"for dir in $DIR_LIST
do if [ ! -d $dir ];then echo "[$dir] is not existed!" continue; fi echo "Enter directory [$dir] " cd $dir for log_part in $LOG_LIST do# echo $log_part find $dir -name "$log_part" -type f -ctime +$GZ_DAY# find $dir -name "$log_part" -type f -ctime +$GZ_DAY|grep -v .gz|xargs -i gzip -f {}# find $dir -name "$log_part" -type f -ctime +$DEL_DAY|grep .gz|xargs -i rm {} done doneCUR_TIME=`date +"%Y%m%d %T"`
echo "END AT [$CUR_TIME]"echo ""exit 0
转载地址:http://clvwn.baihongyu.com/