Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Sep 2000 22:18:24 +1000
From:      "George Osvald" <mail@okstudio.com.au>
To:        <freebsd-questions@FreeBSD.ORG>
Subject:   running a linux script on FreeBSD
Message-ID:  <000001c02621$892d5680$28f438cb@gosvald>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

------=_NextPart_000_0001_01C02675.5AD96680
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

I have a script that is to be executed from crontab to check whether
application is running and if it isn't it should restart it. It works fine
on my RED HAT 6.2 box but I can't get it working on FreeBSD 4.0-RELEASE.
On Linux it doesn't do anything if the application is running. It simply
checks the status and only restarts when the application stops working.
On FreeBSD it stops and then restarts the bloody thing 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="mail@okstudio.com.au"

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


------=_NextPart_000_0001_01C02675.5AD96680
Content-Type: application/octet-stream;
	name="AUTO"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="AUTO"

IyEgL2Jpbi9zaAoKWk9QRURJUj0iL2hvbWUvdmlydHVhbHMvZ29zdmFsZC96b3BlIgpJTkZPTUFJ
TD0ibWFpbEBva3N0dWRpby5jb20uYXUiCgpTVEFSVEZJTEU9IiRaT1BFRElSL3N0YXJ0IgpTVE9Q
RklMRT0iJFpPUEVESVIvc3RvcCIKUElERklMRT0iJFpPUEVESVIvdmFyL1oyLnBpZCIKUElEMUFD
VElWRT0wClBJRDJBQ1RJVkU9MAppZiBbIC14ICRTVEFSVEZJTEUgXTsgdGhlbgogIGlmIFsgLXIg
JFBJREZJTEUgXTsgdGhlbgogICAgUElEMT1gY3V0IC1kIiAiIC1mMSAkUElERklMRWAKICAgIFBJ
RDI9YGN1dCAtZCIgIiAtZjIgJFBJREZJTEVgCiAgICBpZgogICAgcHMgLXAgJFBJRDEgPi9kZXYv
bnVsbCAyPiYxIAogICAgdGhlbgogICAgICBQSUQxQUNUSVZFPTEKICAgIGZpCiAgICBpZgogICAg
cHMgLXAgJFBJRDIgPi9kZXYvbnVsbCAyPiYxCiAgICB0aGVuCiAgICAgIFBJRDJBQ1RJVkU9MQog
ICAgZmkKICBmaQogIGlmIFsgJFBJRDFBQ1RJVkUgLWVxIDAgLW8gJFBJRDJBQ1RJVkUgLWVxIDAg
XTsgdGhlbgogICAgJFNUT1BGSUxFID4vZGV2L251bGwgMj4mMQogICAgc2xlZXAgMTAKICAgICRT
VEFSVEZJTEUKICAgIGRhdGUgfCBtYWlsIC1zIlpvcGUgcmVzdGFydGVkIiAkSU5GT01BSUwgPi9k
ZXYvbnVsbCAyPiYxCiAgZmkKZmkK

------=_NextPart_000_0001_01C02675.5AD96680--



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000001c02621$892d5680$28f438cb>