shell auto example date expr

#引用配置文件中的配置信息
. ./xxxLogBak.cfg

tmpTime=`date +'%Y%m%d%H%M%S'`

willrmdays=`expr ${willcpdays} + ${willorigdays}`

echo "开始备份${tmplogbootDir}/${tmplogDirName}目录下的日志" >> ${BakLogFileName}

if [ ! -d ${tmpbakDirName} ];then
        mkdir ${tmpbakDirName}
    fi

tempFileList=""
    tempFileList=`ls ${tmplogbootDir}/${tmplogDirName} `

    for tempFileName in ${tempFileList}
    do
       mv ${tmplogbootDir}/${tmplogDirName}/${tempFileName} ${tmpbakDirName}/${tmpbakTime}
    done

    if [ ! -d ${BakLogFilePath} ];then
        echo "检查备份目录... ..." >> ${BakLogFileName}
        echo "创建备份目录及下属目录失败,请检查是否有足够权限"
        exit 1;
    fi

touch ${BaseLogBakPath}
echo "完成对备份目录的检查" >> ${BakLogFileName}

猜你喜欢

转载自hollowinheart.iteye.com/blog/573417
今日推荐