
                        Debian bug report logs - #14829
                        wishlist: apache and cron.daily
                                       
   Package: [1]apache; Reported by: Craig Sanders <cas@taz.net.au>; dated
   Fri, 14 Nov 1997 00:18:00 GMT; Maintainer for apache is [2]Johnie
   Ingram <johnie@debian.org>.
     _________________________________________________________________
   
Message received at submit@bugs.debian.org:

Received: (at submit) by bugs.debian.org; 14 Nov 1997 00:03:29 +0000
Received: (qmail 18654 invoked from network); 14 Nov 1997 00:03:24 -0000
Received: from siva.taz.net.au (root@siva.taz.net.au@203.16.167.2)
  by 205.229.104.5 with SMTP; 14 Nov 1997 00:03:24 -0000
Received: from siva.taz.net.au (cas@siva.taz.net.au [203.16.167.2])
        by siva.taz.net.au (8.8.8/8.8.8/Debian/GNU) with SMTP id KAA29000
        for <submit@bugs.debian.org>; Fri, 14 Nov 1997 10:43:40 +1100
Date: Fri, 14 Nov 1997 10:43:20 +1100 (EST)
From: Craig Sanders <cas@taz.net.au>
To: submit@bugs.debian.org
Subject: wishlist: apache and cron.daily
Message-ID: <Pine.LNX.3.96.971114095325.7434B-100000@siva.taz.net.au>
X-No-Junk-Mail: Do not send me junk mail under any circumstances
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII


Package: apache
Version: 1.3b2-1

this is a wishlist item, not a real bug.

the apache package assumes that i want to rotate my log files on a daily
basis. i prefer to do that on a weekly basis. every time i upgrade
apache i have to move /etc/cron.daily/apache to /etc/cron.weekly (and
manually merge in my changes - i run analog for a few virtual servers).

it seems to me that it would be better if the /etc/cron.daily/apache
script could read in a config file for values like:

 - number of history logs (days/weeks to keep)
 - which days to run on (all, mon-sun, etc)
 - name of script to run immediately after rotating logs and restarting
   apache

something like this, perhaps:

--- cut here --- /etc/apache/cron.conf --- cut here ---
# Number of logs to keep
APACHE_OLD_LOGS=52

# which days to run log rotation stuff on
# allowed values are one or more of: Mon,Tue,Wed,Thu,Fri,Sat,Sun,All
# case insensitive.
APACHE_DAYS_TO_RUN=Sun

# post-rotation script to run (leave blank if none)
APACHE_POST_SCRIPT=/usr/local/sbin/run_analog
--- cut here --- /etc/apache/cron.conf --- cut here ---



--- cut here --- /etc/cron.daily/apache --- cut here ---
#!/bin/bash
#
# apache        Rotate the apache logfiles as specified in
#           /etc/apache/cron.conf
#

[ -f /etc/apache/httpd.conf ] || exit 0

# DEFAULTS.  Override by editing /etc/apache/cron.conf
APACHE_OLD_LOGS=35
APACHE_DAYS_TO_RUN=all
APACHE_POST_SCRIPT=

[ -f /etc/apache/cron.conf ] && source /etc/apache/cron.conf

umask 022

# get today's day and convert to lowercase
TODAY=`date +%a | tr 'A-Z' 'a-z'`
# convert days_to_run to lowercase
$APACHE_DAYS_TO_RUN=`echo $APACHE_DAYS_TO_RUN | tr 'A-Z' 'a-z'`

RUNTODAY=0
echo "$APACHE_DAYS_TO_RUN" | grep -q "$TODAY" && RUNTODAY=1
[ "$APACHE_DAYS_TO_RUN" == "all" ] && RUNTODAY=1

if [ "$RUNTODAY" == "1" ] ; then

        # This looks for lines in the conf files like: FooLog /some/where
        LOGS=$(egrep -h "^[:space:]*[A-Za-z]*Log /" /etc/apache/*.conf \
                | sed s/^\ *//g | cut -f 2 -d " ")

        if [ "$LOGS" = "" ]
        then
                LOGS="/var/log/apache/access.log /var/log/apache/error.log"
                [ -d /var/log/apache ] || exit 0
        fi

        SERVERROOT=$(egrep -h "^[:space:]*ServerRoot " /etc/apache/httpd.conf |
 \
                cut -f 2 -d " ")
        if [ "$SERVERROOT" != "" ]
        then
                cd $SERVERROOT
        fi

        USR=$(egrep -h "^User [a-z]" httpd.conf | head -1 | cut -f 2 -d " ")
        if [ "$USR" = "" ]
        then
                USR="root"
        fi

        GRP=$(egrep -h "^Group [a-z]" httpd.conf | head -1 | cut -f 2 -d " ")
        if [ "$GRP" = "" ]
        then
                GRP="www-data"
        fi

        for LOG in $LOGS
        do
                if [ -f $LOG ]
                then
                savelog -c $APACHE_OLD_LOGS -m 664 -u $USR -g $GRP $LOG > /dev/
null
                fi
        done

        # Send a reload signal to the apache server.
        /etc/init.d/apache reload > /dev/null

        # run apache post processing script if executable
        [ -x "$APACHE_POST_SCRIPT" ] && $APACHE_POST_SCRIPT

fi

exit 0
--- cut here --- /etc/cron.daily/apache --- cut here ---



--
craig sanders
networking consultant                  Available for casual or contract
temporary autonomous zone              system administration tasks.

     _________________________________________________________________
   
   Acknowledgement sent to Craig Sanders <cas@taz.net.au>:
   New bug report received and forwarded. Copy sent to Johnie Ingram
   <johnie@debian.org>. [3]Full text available.
     _________________________________________________________________
   
   Report forwarded to debian-bugs-dist@lists.debian.org, Johnie Ingram
   <johnie@debian.org>:
   Bug#14829; Package apache. [4]Full text available.
     _________________________________________________________________
   
   
    [5]Ian Jackson / [6]owner@bugs.debian.org, through the [7]Debian bug
    tracking mechanism
    
   Last modified: 00:39:02 GMT Fri 14 Nov ([8]timestamp page available).

References

   1. file://localhost/u1/johnie/www/bugs/pa/lapache.html
   2. file://localhost/u1/johnie/www/bugs/ma/lJohnie_Ingram,johnie,debian.org,.html
   3. file://localhost/u1/johnie/www/bugs/14/14829-b.html#m2
   4. file://localhost/u1/johnie/www/bugs/14/14829-b.html#m1
   5. http://www.cl.cam.ac.uk/users/iwj10/
   6. mailto:owner@bugs.debian.org
   7. file://localhost/u1/johnie/www/
   8. file://localhost/u1/johnie/www/bugs/ix/zstamp.html
