Cron.Daily Jobs not running on 12.1 and 12.2

I noticed that my logs were not rotating in my 12.1 and 12.2 computers, 11.4 is working fine.

logrotate is in /etc/cron.daily but I have to run it myself to get the logs to rotate. sh /etc/cron.daily/logrotate


ps -ef |grep cron
root      1423     1  0 Nov28 ?        00:00:00 /usr/sbin/cron -n

ls -l /var/spool/cron/lastrun/
-rw-r--r-- 1 root root 0 Nov 28 08:15 cron.daily

ls -l lib/logrotate.status 
-rw-r--r-- 1 root root 1226 Nov 26 08:29 lib/logrotate.status

/etc/cron.daily/logrotate


#!/bin/sh
/usr/bin/touch /root/logrotate.txt
# exit immediately if there is another instance running
if checkproc /usr/sbin/logrotate; then
        /bin/logger -p cron.warning -t logrotate "ALERT another instance of logrotate is running - exiting"
        exit 1
fi

TMPF=`mktemp /tmp/logrotate.XXXXXXXXXX`

/usr/sbin/logrotate /etc/logrotate.conf 2>&1 | tee $TMPF
EXITVALUE=${PIPESTATUS[0]}

if  $EXITVALUE != 0 ]; then
    # wait a sec, we might just have restarted syslog
    sleep 1
    # tell what went wrong
    /bin/logger -p cron.warning -t logrotate "ALERT exited abnormally with $EXITVALUE]"
    /bin/logger -p cron.warning -t logrotate -f $TMPF
 fi

#rm -f $TMPF
exit 0

I added the touch command and commented out the rm command to see if logrotate is being executed. After two days I do not see lograote.txt in /root or logrotate.xxxxxxx in /tmp.


grep cron /var/log/messages
Nov 27 02:45:35 Igor crontab[2114]: (root) LIST (root)
Nov 27 02:45:35 Igor crontab[2115]: (root) LIST (root)
Nov 27 02:46:32 Igor crontab[2117]: (root) BEGIN EDIT (root)
Nov 27 02:46:36 Igor crontab[2117]: (root) END EDIT (root)
Nov 27 02:46:38 Igor crontab[2120]: (root) LIST (root)
Nov 27 02:46:38 Igor crontab[2121]: (root) LIST (root)
Nov 27 02:46:47 Igor crontab[2123]: (root) REPLACE (root)
Nov 27 02:47:01 Igor /usr/sbin/cron[1364]: (root) RELOAD (/var/spool/cron/tabs/root)
Nov 28 04:51:55 Igor /usr/sbin/cron[1423]: (CRON) bad minute (/etc/cron.d/ocsinventory-agent)
Nov 28 04:51:55 Igor /usr/sbin/cron[1423]: (CRON) INFO (running with inotify support)

I don’t know why the cron.daily file is updating but cron.daily jobs are not running. Is any one else having problems with cron.daily? Thanks.

Dave W

On 2012-11-29 13:36, dwestf wrote:
> I don’t know why the cron.daily file is updating but cron.daily jobs
> are not running. Is any one else having problems with cron.daily?
> Thanks.

Daily jobs are started from /etc/crontab, start there first. There is a
line that outputs to null, send it to a log instead.

Then edit “/etc/sysconfig/cron” and define SYSLOG_ON_NO_ERROR and
SEND_OUTPUT_ON_NO_ERROR both to yes. Ah, and SEND_MAIL_ON_NO_ERROR too.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

Thanks Carlos,

I made the changes, all but the email. Not allowed to have a mail service running. I will get the output tomorrow morning.

Dave

Just remembered, I am out tomorrow so I will get it on Monday.

On 2012-11-29 16:36, dwestf wrote:
>
> Thanks Carlos,
>
> I made the changes, all but the email. Not allowed to have a mail
> service running. I will get the output tomorrow morning.

Not allowed by whom? !!

You are breaking a Linux system services. What else have you broken or
modified on that system?


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)