#!/bin/sh
#
### BEGIN INIT INFO
# Provides: hasplm
# Required-Start: network
# Required-Stop: network
# Default-Start: 2 3 4 5
# Default-Stop:
# Description:  Aladdin HASP License Manager
### END INIT INFO

# $Id: hasplm.suse,v 1.2 2004/06/08 14:55:10 chris Exp $

test -s /etc/rc.config && \
    . /etc/rc.config

test -s /etc/rc.status && \
    . /etc/rc.status

## Determine the base and follow a runlevel link name.
#base=${0##*/}
#link=${base#*[SK][0-9][0-9]}
#
## Force execution if not called by a runlevel directory.
#test $link = $base && START_HASPLM=yes
#test "$START_HASPLM" = yes || exit 0
#
# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status

# First reset status of this service
rc_reset
case "$1" in
    start)
	echo -n "Starting HASP LM"

	startproc /usr/sbin/hasplm

	# Remember status and be verbose
	rc_status -v
	;;
    stop)
	echo -n "Shutting down HASP LM"

	killproc -TERM /usr/sbin/hasplm

	# Remember status and be verbose
	rc_status -v
	;;
    restart)
	$0 stop  &&  $0 start

	# Remember status and be quiet
	rc_status
	;;
    reload)

	$0 stop  &&  $0 start

	# Remember status and be verbose
	rc_status -v
	;;
    status)
	echo -n "Checking for HASP LM: "

	checkproc /usr/sbin/hasplm && echo OK || echo No process
	;;
    *)
	echo "Usage: $0 {start|stop|status|restart|reload}"
	exit 1
	;;
esac
rc_exit
