I have lograotate configured on CentOS 6. It works fine when I run it manually, but with CRON it doesn't work. Cron says in its logs: "All fine, I run you command" but nothing happens. Details:
cat /etc/logrotate.d/myproject
/var/opt/myproject/log/error.log {
size=200M
rotate 25
missingok
notifempty
copytruncate
nocreate
nocompress
nodateext
}
cat /etc/cron.d/1everymin
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
* * * * * root /etc/cron.min/logrotate
cat /etc/cron.min/logrotate
#!/bin/sh
#/usr/sbin/logrotate /etc/logrotate.conf >/dev/null 2>&1
/usr/sbin/logrotate -v /etc/logrotate.conf > /logrotate.log
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
Every minute I see in /var/log/cron
Jan 16 21:40:01 localhost CROND[31541]: (root) CMD (/etc/cron.min/logrotate)
Jan 16 21:41:01 localhost CROND[31552]: (root) CMD (/etc/cron.min/logrotate)
Jan 16 21:42:01 localhost CROND[31561]: (root) CMD (/etc/cron.min/logrotate)
Jan 16 21:43:01 localhost CROND[31575]: (root) CMD (/etc/cron.min/logrotate)
Jan 16 21:44:01 localhost CROND[31587]: (root) CMD (/etc/cron.min/logrotate)
But log actually is not rotated: nothing happens, /logrotate.log is empty
If I execute /etc/cron.min/logrotate manually all working fine, /logrotate.log have information about log rotating