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

Knut Auvor Grythe knut.a.grythe at ntnu.no
Mon Sep 22 10:00:58 BST 2008


Public bug reported:

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 at 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.

** Affects: apache2 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
/etc/init.d/apache2 routinely prints to stderr if few modules are enabled, causing logrotate to spam in cron
https://bugs.launchpad.net/bugs/273043
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to apache2 in ubuntu.



More information about the Ubuntu-server-bugs mailing list