#! /bin/bash
#   /***************************************************************************
#   **                                                                        **
#   **  License                                                               **
#   **  =======                                                               **
#   **                                                                        **
#   **  This software program is released under the terms of a license        **
#   **  agreement between you ('Licensee') and Intel. Do not use or load this **
#   **  software or any associated materials (collectively, the 'Software')   **
#   **  until you have carefully read the full terms and conditions of the    **
#   **  LICENSE located in this software package. By loading or using the     **
#   **  Software, you agree to the terms of this Agreement. If you do not     **
#   **  agree with the terms of this Agreement, do not install or use the     **
#   **  Software.                                                             **
#   ***************************************************************************/
#
#   /***************************************************************************
#   **                                                                        **
#   ** INTEL CORPORATION                                                      **
#   **                                                                        **
#   ** This software is supplied under the terms of the license included      **
#   ** above.  All use of this software must be in accordance with the terms  **
#   ** of that license.                                                       **
#   **                                                                        **
#   **  Abstract:                                                             **
#   **    Initialization script for PROCfgd (Caldera)                          **
#   **                                                                        **
#   ***************************************************************************/
#
# $Id: skeleton,v 1.8 1999/07/19 14:36:10 ray Exp ray $
#
### BEGIN INIT INFO
# Provides: procfgd
# Required-Start: network
# Required-Stop: 
# Default-Start: 2 3 4 5
# Default-Stop: 
# Description: procfgd
#		example file to build /etc/rc.d/init.d/ scripts.
#		This file should be used to construct scripts
#		for /etc/rc.d/init.d.
### END INIT INFO
#
# Written by Miquel van Smoorenburg <miquels@drinkel.ow.org>.
# Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
# Modified for OpenLinux by Raymund Will <ray@caldera.de>

NAME="procfgd"
DAEMON="/usr/sbin/$NAME"

# Source function library (and set vital variables).
. /etc/rc.d/init.d/functions

start() {
    [ ! -e $SVIlock ] || exit 0
    [ -x $DAEMON ] || exit 5

    echo -n "Starting $SVIsubsys services: "
    ssd -S -x $DAEMON -n $NAME -- $OPTIONS
    ret=$?

    echo "."
    sleep 1
    #[ -x /usr/sbin/procfg ] && /usr/sbin/procfg -f restore
    touch $SVIlock
}

stop() {
    [ -e $SVIlock ] || exit 0

    echo -n "Stopping $SVIsubsys services: "
    ssd -K -p /var/run/$NAME.pid -x $DAEMON -n $NAME
    ret=$?

    echo "."
    rm -f $SVIlock
}

case "$1" in
    start)
        start
        ;;

    stop)
        stop
        ;;

    restart)
        stop
        start
        ;;

    *)
        echo "Usage: $SVIscript {start|stop|restart}"
        ret=2
        ;;
esac

exit $ret

