#!/bin/sh
# 
# netdisco daemon start stop script
#
#   chkconfig: 345 95 5
#   description: Startup/shutdown script for the Netdisco Admin Daemon

USER=netdisco
NETDISCO=/usr/pkg/netdisco

# Linux : Source function library.
if [ -f /etc/init.d/functions ] ; then
    . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
    . /etc/rc.d/init.d/functions
fi

case $1 in
    start)
        echo -n "Starting netdisco admin daemon:"
        su -l $USER -c "$NETDISCO/netdisco -p start"
    ;;
    stop)
        echo -n "Stopping netdisco admin daemon:"
        su -l $USER -c "$NETDISCO/netdisco -p stop"
    ;;
    restart)
        echo -n "Restarting netdisco admin daemon:"
        su -l $USER -c "$NETDISCO/netdisco -p restart"
    ;;
    status)
        $NETDISCO/netdisco -p status
    ;;
    *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
esac
