cron配置
vim /etc/cron.hourly/logrotate
#!/bin/sh
/usr/sbin/logrotate /etc/logrotate.d/cmp
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
logrotate配置
/etc/logrotate.d/cmp
/var/log/app/*/*.log {
su root root
daily
rotate 180
size 50M
compress
delaycompress
missingok
notifempty
dateext
dateformat -%Y%m%d.%s
}
crontab服务
启动
systemctl status crond
systemctl start crond
systemctl ebable crond
网友评论