tjl2.com

A place to store useful stuff

Want great value broadband? - Move to Force9 for FREE!
Super-fast broadband

 

[ENSIM] Weblogs script no longer runs after updating cron package

The Red Hat Errata RHSA-2006:0117 for RHEL 3 provided an updated vixie-cron rpm, which fixed a low-priority security issue and a bug in the cron deamon. This update was applied using the up2date system.

After applying this particular update, we found that Webalizer had stopped running on all virtual sites. It turned out that Ensim's weblogs script had stopped running. This script is supposed to run every 10 minutes on an Ensim system, as defined in the /etc/cron.d/weblogs.d crontab file. After spotting that this script was no longer running, we spotted error messages in the /var/log/cron log file, which stated the following:

(*system*) BAD FILE MODE (/etc/cron.d/weblogs.d)

Looking in the man pages for cron and crontab did not reveal anything useful about this message. However, after looking at the same man page for crontab (man 5 crontab) on a RHEL 4 system, I saw the following section of text at the end of the page:

CAVEATS
In this version of cron, /etc/crontab must not be writable by any user
other than root. No crontab files may be links, or linked to by any
other file. No crontab files may be executable, or be writable by any
user other than their owner.

This behaviour was showing up in the cron deamon on RHEL 3. It appears that the vixie-cron package (or some of it's functionality) has been backported from RHEL 4.

To fix the issue and get Webalizer stats working again on all virtual sites, run the following commands as root on all affected servers:

chown root:root /etc/cron.d/*

chmod 644 /etc/cron.d/*

/etc/init.d/crond restart

As a quick method to get the Webalizer stats up to date on a server, rather than waiting for the above commands to fix the issue when cron runs the weblogs, you can run the following command as root:

for dom in `sitelookup -a domain`; do sadmin=`sitelookup -d $dom site_admin`; \

chroot /home/virtual/$dom logrotate -f /etc/logrotate.conf; \

chroot /home/virtual/$dom su - $sadmin -c "webalizer -c /etc/webalizer/web/webalizer.conf"; done

back