Merge branch 'master' of mathias-kettner.de:omd
[omd.git] / packages / maintenance / logrotate
blobd94c3c2d96699250e4790acc338908527ef915bd
1 #! /bin/sh
4 # Whenever /etc/cron.daily/logrotate starts to run under a SLES system,
5 # it first calls checkproc to make sure that there is no other logrotate
6 # process already running.
7 # Under rare circumstances (system-logrotate running at midnight)
8 # the omd-logrotate can be such a rival process. If it is the first to run
9 # (even a few microseconds before /etc/cron.daily/logrotate is launched)
10 # there will be no more rotation of the logs in /var/log/apache.
11 # In a heavily used OMD-system the /var-partition will be filled up very
12 # quickly.
13 # checkproc is symlink-aware, so we need to run our own copy of logrotate.
16 SBIN_LOGROTATE=/usr/sbin/logrotate
17 LOCAL_LOGROTATE=$OMD_ROOT/var/tmp/logrotate
18 if [ ! -x $LOCAL_LOGROTATE ] || \
19 [ $(stat --dereference --format "%s" $LOCAL_LOGROTATE) -ne \
20 $(stat --dereference --format "%s" $SBIN_LOGROTATE) ]; then
21 DIR=$(dirname $LOCAL_LOGROTATE)
22 if [ ! -d $DIR ]; then
23 mkdir -p $DIR
25 cp -f $SBIN_LOGROTATE $LOCAL_LOGROTATE
27 $LOCAL_LOGROTATE $@