# Problem with logrotate, rotating apache initscript as well

## planet-admin

I have logrotate configured to rotate apache logs, and I'm using ispcp omega. The logs are being rotate properly, however, so is the apache2 init script in /etc/init.d (ending up with a 0 byte apache2 init script). Here is the /etc/logrotate.d/apache2 file, I know there's a syntax error, but I don't know where it's at?

```
# Apache2 logrotate snipet for Gentoo Linux

# Contributes by Chuck Short

#

/var/log/apache2/*log {

  missingok

  notifempty

  sharedscripts

        prerotate

                /var/www/ispcp/engine/awstats/awstats_updateall.pl now -awstatsprog=/var/www/localhost/cgi-bin/awstats.pl &> /dev/null

        endscript

        postrotate

                /etc/init.d/apache2 reload > /dev/null 2>&1 || true

        endscript

}
```

Can anyone help me spot it?

Michael

----------

## bodri12

Same problem here, if i have ispcp file in logrotate.d directory too, that have apache reference too. Just see, rewrite your /dev/null too.

Here is a relevant part of ispcp file:

```

/var/log/apache2/users/*.log {

  weekly

  missingok

  rotate 52

  compress

  delaycompress

  notifempty

  create 640 root adm

  sharedscripts

  prerotate

    /var/www/ispcp/engine/traffic/ispcp-vrl-traff >/var/log/ispcp/ispcp-vrl-traff.log 2>&1

  endscript

  postrotate

    if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then

      /etc/init.d/apache2 reload > /dev/null

    fi

  endscript

}

# Rotation for user traffic prevs

#

/var/log/apache2/backup/*.log.prev {

  size 5M

  missingok

  rotate 5

  compress

  delaycompress

  notifempty

  create 640 root adm

}

# Rotation for apache2, launching general statistics if awstats is installed

#

/var/log/apache2/*.log {

  weekly

  rotate 52

  missingok

  compress

  delaycompress

  notifempty

  create 640 root adm

  sharedscripts

  prerotate

        if [ `cat /etc/ispcp/ispcp.conf | grep -c 'AWSTATS_ACTIVE *= *yes'` = 1 ]; then

      perl /var/www/ispcp/engine/awstats/awstats_updateall.pl now -awstatsprog=/usr/lib/cgi-bin/awstats.pl >/dev/null 2>&1

    fi

  endscript

  postrotate

    if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then

                /etc/init.d/apache2 reload > /dev/null

    fi

  endscript

}

```

If you delete the apache file, then not will rotate runscript, but logrotate wont work well. Anyway reload is an invalid option, use restart instead (not tested yet).

Any logrotate expert can help what's wrong if both script is running ?

----------

