#!/bin/sh
#
# Solaris rc2 script for the EPICS CA Repeater.
#

INSTALL_BIN=:INSTALL_BIN:
EPICS=:EPICS:

# To change the default values for the EPICS Environment parameters,
# uncomment and modify the relevant lines below.

# EPICS_CA_ADDR_LIST=""
# EPICS_CA_CONN_TMO="30.0"
# EPICS_CA_BEACON_PERIOD="15.0"
# EPICS_CA_AUTO_ADDR_LIST="YES"
# EPICS_CA_REPEATER_PORT="5065"
# EPICS_CA_SERVER_PORT="5064"
# export EPICS_CA_ADDR_LIST
# export EPICS_CA_CONN_TMO
# export EPICS_CA_BEACON_PERIOD
# export EPICS_CA_AUTO_ADDR_LIST
# export EPICS_CA_REPEATER_PORT
# export EPICS_CA_SERVER_PORT

if [ $1 = "start" ]; then
	if [ -x $INSTALL_BIN/startCArepeater ]; then
		echo "Starting EPICS CA repeater "
		PATH=$INSTALL_BIN:$PATH: export PATH
		$INSTALL_BIN/startCArepeater
        fi
else
        if [ $1 = "stop" ]; then
                pid=`/usr/bin/ps -e | /usr/bin/grep caRepeat | /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`   
                if [ "${pid}" != "" ]; then
                        echo "Stopping EPICS CA Repeater "
                        /usr/bin/kill ${pid}
                fi     
        fi
fi

