Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a daily cronjob set up on CentOS 6 OS which should look after the log rotation job. The file is /etc/cron.daily/logrotate and it's contents are

/usr/sbin/logrotate /etc/logrotate.conf >/dev/null 2>&1
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
exit 0

I expected that logs will be rotated as being activated by this daily cronjob but it isn't. I see no evidence that the daily cronjob is run from the log file /var/log/cron. However, the hourly jobs are run as shown by the log file.

I have added a line on /etc/crontab file

# run-parts
02 4 * * * root run-parts /etc/cron.daily 

but that made no change.

I have no idea why this log rotation isn't working. I would be pleased if someone can shed some light.

share|improve this question
Is /etc/cron.daily/logrotate executable? ls -l /etc/cron.daily/logrotate. – Spack Apr 23 '14 at 9:27
yes, it is. -rwxr-xr-x 1 root root 196 Jun 22 2012 /etc/cron.daily/logrotate – mezi Apr 23 '14 at 9:47
Make your script verbose so you will see if it's running fine. For example, you can remove >/dev/null 2>&1 to have logrotate output. – Spack Apr 23 '14 at 10:04
I made the change as you suggested and found some errors. I have fixed the error and now it's no longer showing any error. I will check later whether daily crons are running. – mezi Apr 23 '14 at 10:33

Your Answer


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

Browse other questions tagged or ask your own question.