Some time ago I asked for help when setting up crontab to restart ZOPE. I
got a few answers and scripts. This one was sent to me by Adam Karpierz. It
works fine on my RED HAT 6.2 box but I can't get it working on FreeBSD 4.0.
On Linux it doesn't do anything if ZOPE is running. It only restarts when
ZOPE stops working. On FreeBSD it stops and then restarts ZOPE every time. I
wander if anyone knows what should be changed for this script to run on
FreeBSD. Any help would be appreciated.

--------------------------------------------

#! /bin/sh

ZOPEDIR="/home/virtuals/user/zope"
INFOMAIL="[EMAIL PROTECTED]"

STARTFILE="$ZOPEDIR/start"
STOPFILE="$ZOPEDIR/stop"
PIDFILE="$ZOPEDIR/var/Z2.pid"
PID1ACTIVE=0
PID2ACTIVE=0
if [ -x $STARTFILE ]; then
  if [ -r $PIDFILE ]; then
    PID1=`cut -d" " -f1 $PIDFILE`
    PID2=`cut -d" " -f2 $PIDFILE`
    if
    ps -p $PID1 >/dev/null 2>&1
    then
      PID1ACTIVE=1
    fi
    if
    ps -p $PID2 >/dev/null 2>&1
    then
      PID2ACTIVE=1
    fi
  fi
  if [ $PID1ACTIVE -eq 0 -o $PID2ACTIVE -eq 0 ]; then
    $STOPFILE >/dev/null 2>&1
    sleep 10
    $STARTFILE
    date | mail -s"Zope restarted" $INFOMAIL >/dev/null 2>&1
  fi
fi


-------------------------------------------------------

Regards,

George

AUTO

Reply via email to