Add logrotate file to/etc/cron.daily
#!/bin/sh
/usr/sbin/logrotate/etc/logrotate.conf
Exitvalue=$?
if [$EXITVALUE! = 0]; Then
/usr/bin/logger-t logrotate "ALERT exited abnormally with [$EXITVALUE]"
Fi
Exit 0
Add a log profile to the/ETC/LOGROTATE.D to configure the delete log
/log/*.log {
Daily
Noolddir
Rotate 7
Missingok
Notifempty
Sharedscripts
Postrotate
/bin/kill-hup ' cat/var/run/syslogd.pid 2>/dev/null ' 2>/dev/null | | True
/bin/kill-hup ' cat/var/run/rsyslogd.pid 2>/dev/null ' 2>/dev/null | | True
Endscript
}
Force restart Rollback Service
#logrotate-vf/etc/logrotate.conf
Or
/usr/sbin/logrotate-vf/etc/logrotate.conf
CRONTAB-L//Display the contents of the user's crontab file
CRONTAB-E//Edit the contents of a user's crontab file
Crontab-r//delete user's crontab file
Create a new execution script in the root directory
Touch logrotate.sh
#! /bash/sh
Su-root-c "Logrotate-vf/etc/logrotate.conf"
chmod u+x logrotate.sh
New timed Start
#crontab-E
5 7,19 * * * sh/root/logrotate.sh >> logrotate.log 2>&1
Restart Timer service
Service Crond Restart
Restart Log service
Service Syslog Restart
Force a rollback
Logrotate-vf/etc/logrotate.conf
This article is from the "Light Sigh Heart" blog, please be sure to keep this source http://dantanmingxin.blog.51cto.com/2061202/1827823
Linux log rollback