想利用Logrotate实现对nohup.out日志的每日备份,nohup.out是通过nohup命令生成的weblogic应用日志,配置完成后直接执行“ /usr/sbin/logrotate /etc/logrotate.conf” 命令,没有生成任何备份文件,也没有报错提示,logrotate.conf中内容如下:
/home/bea1/basedomain/bin/nohup.out{
daily
prerotate
/usr/bin/chattr -a /home/bea1/basedomain/bin/nohup.out
endscript
copytruncate
create mode owner group nohup.out.date +%Y%m%d%H%M
olddir /home/bea1/basedomain/bin
rotate 1
postrotate
/usr/bin/chattr +a /home/bea1/basedomain/bin/nohup.out
endscript
}