您的位置:首页 > 运维架构 > Shell

[linux] linux shell 将解析完毕的文件备份至其他目录

2016-12-13 15:44 330 查看
#!/bin/bash
#
#将解析完毕的日志备份到别的目录
#

#日志目录
rjPath=`ls /home/bgftp/orj`
#当前时间戳
cur=`date +%s`
#一小时
chtm=3600000
for rpath in $rjPath

do
#获取文件的时间戳
ctm=`date +%s -r /home/bgftp/orj/$rpath`
subct=$[cur*1000-ctm*1000]
#大于一小时的日志备份
if [ "$subct" -gt "$chtm" ]
then
`mv /home/bgftp/orj/$rpath  /home/bgftp/orjback`
fi
done


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: