简单备份日志脚本
时间:2010-09-20 来源:zbhdpx
%cat cutlog.sh
#!/bin/sh
date=`date -v +0d +%Y%m%d%H%M%S`
logpatch=`pwd`
bakpatch=/var/log/logbak
mv $logpatch/$1 $bakpatch/$date.log && tail -100 $bakpatch/$date.log >$logpatch/$1
if [ $? -eq 0 ];then
echo bak seccessful
else
echo bak failed
fi
date=`date -v +0d +%Y%m%d%H%M%S`
logpatch=`pwd`
bakpatch=/var/log/logbak
mv $logpatch/$1 $bakpatch/$date.log && tail -100 $bakpatch/$date.log >$logpatch/$1
if [ $? -eq 0 ];then
echo bak seccessful
else
echo bak failed
fi
相关阅读 更多 +