logrotate not working via cron
by oliveoyl from LinuxQuestions.org on (#593R4)
Hi all,
I'm trying to figure out why syslogs are not getting rotated. When I run logrotate manually from root (/usr/sbin/logrotate /etc/logrotate.conf) it works ok. I also tried -f flag to see it that gets things going. But I just checked today and had to rotate them manually again. Any ideas what else to check/fix?
# ls -ltr messages* | tail -4
-rw-------. 1 root root 322880791 Oct 9 10:08 messages-20201008
-rw-------. 1 root root 121203677 Oct 13 05:48 messages-20201012
-rw-------. 1 root root 107448453 Oct 14 06:44 messages-20201013
-rw-------. 1 root root 222266947 Oct 14 06:57 messages
# ls -l /etc/cron.daily/logrotate
-rwxr-xr-x. 1 root root 219 Oct 15 2019 /etc/cron.daily/logrotate
# cat /etc/cron.daily/logrotate
#!/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
# cat /etc/logrotate.d/syslog
/var/logs/cron
/var/logs/maillog
/var/logs/messages
/var/logs/secure
/var/logs/spooler
/var/logs/kernel
/var/logs/emergency
/var/logs/ldap
/var/logs/boot
{
daily
dateext
dateyesterday
missingok
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
rotate 1461
}


I'm trying to figure out why syslogs are not getting rotated. When I run logrotate manually from root (/usr/sbin/logrotate /etc/logrotate.conf) it works ok. I also tried -f flag to see it that gets things going. But I just checked today and had to rotate them manually again. Any ideas what else to check/fix?
# ls -ltr messages* | tail -4
-rw-------. 1 root root 322880791 Oct 9 10:08 messages-20201008
-rw-------. 1 root root 121203677 Oct 13 05:48 messages-20201012
-rw-------. 1 root root 107448453 Oct 14 06:44 messages-20201013
-rw-------. 1 root root 222266947 Oct 14 06:57 messages
# ls -l /etc/cron.daily/logrotate
-rwxr-xr-x. 1 root root 219 Oct 15 2019 /etc/cron.daily/logrotate
# cat /etc/cron.daily/logrotate
#!/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
# cat /etc/logrotate.d/syslog
/var/logs/cron
/var/logs/maillog
/var/logs/messages
/var/logs/secure
/var/logs/spooler
/var/logs/kernel
/var/logs/emergency
/var/logs/ldap
/var/logs/boot
{
daily
dateext
dateyesterday
missingok
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
rotate 1461
}