LSTSRV-L Archives

LISTSERV Site Administrators' Forum

LSTSRV-L

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Dennis Boone <[log in to unmask]>
Mon, 1 May 2000 09:49:30 -0400
text/plain (102 lines)
 > Can someone give us an idea, or is their a known script to rotate
 > the listserv.log file nightly in a UNIX environment.

I stop and start LISTSERV each day, using a script run from cron.
This requires a modification to the "go" script supplied by L-Soft,
which otherwise cycles the log each time it starts LISTSERV.

Attached are a diff for the go script, and my nightly cycle script.

Dennis Boone
H-Net

------------------------------------------------------------------------------
*** orig/go    Mon Jul 20 16:52:54 1998
--- mine/go  Wed Jun 23 18:35:39 1999
***************
*** 54,63 ****
  then
      if [ -s listserv.log ]
      then
!         mv listserv.log listserv.log.OLD
      fi
      echo "> Starting LISTSERV as a background process"
!     lsvlog="2>&1 >listserv.log"
      if [ "$notty" != "Y" ]
      then
          lsvdet="&"
--- 55,65 ----
  then
      if [ -s listserv.log ]
      then
!       :
!         #mv listserv.log listserv.log.OLD
      fi
      echo "> Starting LISTSERV as a background process"
!     lsvlog="2>&1 >>listserv.log"
      if [ "$notty" != "Y" ]
      then
          lsvdet="&"
------------------------------------------------------------------------------
#!/bin/sh
# listserv_cycle, Boone, 07/09/99
# Restart listserv daily, cycle log files

# Initialize

        NOTIFY="[log in to unmask]"
        LSVHOME="/path/to/listserv"
        TODAY=`date +%Y%m%d`

        cd $LSVHOME

# Stop listserv

        # Kill it

        PIDS=`ps auxww | grep lsv | grep -v grep | awk '{print $2}'`
        if [ "X$PIDS" != "X" ]
        then
                kill $PIDS
                sleep 60
        fi

        # Serious lossage; phasers on kill

        PIDS=`ps auxww | grep lsv | grep -v grep | awk '{print $2}'`
        I=0
        SIG=
        while [ "X$PIDS" != "X" ]
        do
                I=`expr $I + 1`
                if [ $I -gt 1 ]
                then
                        /usr/bin/Mail -s "listserv failed to stop" \
                                $NOTIFY <<EOF
Listserv (pids $PIDS) failed to stop when killed.
Iteration count is now $I.
EOF
                fi
                if [ $I -gt 2 ]
                then
                        # Eat flaming death
                        SIG="-9"
                fi
                kill $SIG $PIDS
                sleep 30
                PIDS=`ps auxww | grep lsv | grep -v grep | awk '{print $2}'`
        done

# Age the log file

        mv listserv.log log_archives/listserv.log.$TODAY

# Restart listserv

        ./go bg &

# Done

        exit 0
------------------------------------------------------------------------------

ATOM RSS1 RSS2