#!/bin/sh
cd `dirname $0` > /dev/null
BASE=/code/jarc/bin/
cd -

port=1099
rmid_port=1098
if [ -n "$1" ] ; then
port=$1
fi

ps -ef | grep rmiregistry  | grep -v grep> /dev/null
    RET=$?
    if [ $RET = 1 ] ; then 
      echo "starting registry"
      rmiregistry $port &
      PID=$!
      echo $PID
    fi
  trap 'kill -9 $PID' QUIT
  trap 'kill -9 $PID' INT

rmid -port $rmid_port -J-Djava.security.policy=file:$BASE/rmid.policy -J-Djarc.activation.security.policy=file:$BASE/jarc.policy

