/etc/init.d/apache2 routinely prints to stderr if few modules are enabled, causing logrotate to spam in cron

Bug #273043 reported by Knut Auvor Grythe
4
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: apache2-common

We have a server which basically runs a vanilla apache, with very few modules enabled. Every night, logrotate sends us this cron mail:

  Subject: Cron <root@hostname> test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily

  /etc/cron.daily/logrotate:
  grep: /etc/apache2/mods-enabled/*.conf: No such file or directory

This is caused by /etc/init.d/apache2 skimming through the config file to find the PidFile setting, like this:

        for i in $AP_CONF `awk '$1 ~ /^\s*[Ii]nclude$/ && $2 ~ /^\// {print $2}' $AP_CONF`; do
                PIDFILE=`grep -i ^PidFile $i | tail -n 1 | awk '{print $2}'`
                if [ -e "$PIDFILE" ]; then
                        PID=`cat $PIDFILE`
                fi
        done

The problem is when these globs in /etc/apache2/apache2.conf do not match any files:

  Include /etc/apache2/mods-enabled/*.load
  Include /etc/apache2/mods-enabled/*.conf

I have attached a patch which redirects stderr from grep to /dev/null. This should solve the problem without any negative side-effects as far as I can tell.

Oh, and if anyone with the same problem reads this before it is patched: A work-around for this problem is to create an empty file (or two) in /etc/apache2/mods-enabled.

Revision history for this message
Knut Auvor Grythe (knut-a-grythe) wrote :
Revision history for this message
Chuck Short (zulcss) wrote :

Hi,

For whatich apache version is this patch for?

Thanks
chuck

Changed in apache2:
status: New → Incomplete
Revision history for this message
Knut Auvor Grythe (knut-a-grythe) wrote :

Ooops, I'm sorry I forgot to mention that.

Package: apache2-common
Version: 2.0.55-4ubuntu2.3

In other words, the one in Ubuntu Dapper. The one in Hardy seems to be completely different, so the bug probably doesn't apply there.

Revision history for this message
Dimitrios Symeonidis (azimout) wrote :

knut, as per your last comment, I'm assuming this issue is fixed in newer versions of apache2, so I'm marking this report as such

Changed in apache2 (Ubuntu):
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.