Linux 日志切割脚本

!/bin/sh

function rotate() {
logs_path=$1
t=date +"%Y%m%d%H%M"

echo Rotating Log: $1
cp ${logs_path} ${logs_path}.${t}.log
echo "">${logs_path}
chown xmetc.xmetc ${logs_path}
scp ${logs_path}.${t}.log [email protected]:/data/logrotate/luqiaotong/lqt-api1-172.20.70.50
}

for i in $*
do
rotate $i
done

你可能感兴趣的:(Linux 日志切割脚本)