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]>
Thu, 27 Jan 2000 17:04:40 -0500
text/plain (79 lines)
 > We are just issuing a go bg.  Actually we have a crontab that does it
 > for us.  What should we add to the "go" script to make it work better?
 > I would imagine other people have this problem also.

My script for our nightly cycle follows.  I age off log files as I
do this.  This looks fairly simple, but there's some hidden learning,
e.g. it takes our LISTSERV 30 seconds to die sometimes, due to delays
in closing down all its delivery channels.  Also, sending a "STOP"
command is almost completely pointless, as it can take too long to get
through the queue to be useful.  (I had one sent at midnight-ish which
was acted upon at 2:08 AM, long after a kill-restart, once.)  On VM,
where interactive messages were taken out of order, STOP worked better.
(Listening, Eric? :-)  Of course, on VM, closing spooled console logs
and transferring them was nicer too.

Dennis Boone
H-Net

#!/bin/sh
# listserv_cycle, Boone, 07/09/99
# Restart listserv daily, cycle log files

# Initialize

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

        cd $LSVHOME

# Stop listserv

        # Yo, wake up and die

        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