#! /bin/sh
#
# chkconfig: 2345 95 05
# description: encrypted voice relay
# processname: evrelay
#############################################################################
#
# @(#) Copyright (c) 2008,2009 Systems Research and Applications Corporation.
# @(#) All Rights Reserved.
# @(#) SRA PROPRIETARY
# @(#) $Id: evrelay.sh.in,v 1.5 2009/02/12 22:33:27 garfield Exp $
#
#############################################################################

# Get config.
. /etc/sysconfig/network

# Get functions
. /etc/init.d/functions

# Check that networking is up.
if [ ${NETWORKING} = "no" ] ; then
        exit 0
fi

RETVAL=0

start() {
        echo -n "Starting evrelay: "
        prefix=/usr
        exec_prefix=${prefix}
        cd /etc/evrelay
        ${exec_prefix}/bin/evrelay_launcher &
        echo
        touch /var/lock/subsys/evrelay
        return 0
}

stop() {
        echo -n "Stopping evrelay: "
        killproc evrelay
        echo
        rm -f /var/lock/subsys/evrelay
        return 0
}

restart() {
        stop
        start
}

# See how we were called.
case "$1" in
 start)
        start
        ;;
 stop)
        stop
        ;;
 status)
        status evrelay
        ;;
 restart)
        restart
        ;;
 condrestart)
        [ -f /var/lock/subsys/evrelay ] && restart || :
        ;;
 *)
        echo "Usage: $0 {start|stop|status|restart}"
        exit 1
        ;;
esac

exit $?
