#!/bin/sh

PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/ucb:/usr/ccs/bin"; export PATH
LD_LIBRARY_PATH="/usr/lib:/usr/local/lib:/usr/sfw/lib"; export LD_LIBRARY_PATH

# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ]; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done

PRGDIR=`dirname "$PRG"`
PRGDIR=`cd $PRGDIR;pwd`
LD_LIBRARY_PATH=$PRGDIR/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH

OPHome="$PRGDIR"
OPDaemon="rtnn"
OPCmd=$OPHome/$OPDaemon
pid_file=$OPHome/data/`hostname`.pid

while true
do
  eval "$OPCmd"

  if test ! -f "$pid_file"		# This is removed if normal shutdown
  then
    break
  fi
done
