Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 {
    rotate 25

cat /etc/cron.d/1everymin

* * * * * root /etc/cron.min/logrotate

cat /etc/cron.min/logrotate


#/usr/sbin/logrotate /etc/logrotate.conf >/dev/null 2>&1
/usr/sbin/logrotate -v /etc/logrotate.conf > /logrotate.log
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
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

share|improve this question
Has the /var/opt/myproject/log/error.log gotten to the required size of 200M? –  ZaSter Jan 23 '13 at 20:10
Yes, of course. It's manually filled up to 500 mb. Ok, I dont know why, but when I add the same cronjob via crontab -e under the root user it works fine –  odiszapc Jan 24 '13 at 6:12
What are you expecting? because it's really common for people to assume the logs will rotate every time logrotate is run. That's not what it'll do here. –  Matt Mar 10 at 2:57

1 Answer 1

If SELinux is enabled, cron will not be allowed to write into / To see if it is enabled, use:


Try logging somewhere else temporarily such as /var/log/logrotate.log

Be sure to look for denies in /var/log/audit/auditd.log assuming that auditd is enabled.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.