#!/bin/sh
#
# Init file for HPTools server daemon
#
# chkconfig: on 103 103
# description: HPTools server daemon
#
# processname: sutd
# pidfile: /var/run/sutd.pid

RETVAL=0
prog="sut"

# Some functions to make the below more readable
HPTOOLSD=/opt/sut/bin/sut
PID_FILE=/var/run/sutd.pid

# Create a symlink to SUT binary so sut commands can be run without 
# providing the full path to the binary

ln -s /opt/sut/bin/sut /bin/sut

start()
{
        OPTIONS=-start
        echo -n $"Starting $prog"
        $HPTOOLSD $OPTIONS > /dev/null 2>&1
        RETVAL=$?
        echo
}

stop()
{
        echo -n $"Stopping $prog"
        OPTIONS=-stop
        $HPTOOLSD $OPTIONS > /dev/null 2>&1
        RETVAL=$?
        echo
}

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        *)
                echo $"Usage: $0 {start|stop}"
                RETVAL=1
esac
exit $RETVAL
