#! /bin/sh
#
# Copyright (c) 2010 BRUNIE Software GmbH.
# All rights reserved.
# Author: BRUNIE Software GmbH
# Version: 2010.01
#
# 
# chkconfig: 235 99 10
# description: Start or stop the BRUNIE API
#
#
### BEGIN INIT INFO
# Provides: BRUNIE-API
# Required-Start: $syslog $remote_fs $network
# Required-Stop: $syslog $remote_fs $network
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: BRUNIE-API for Linux-GT.M
### END INIT INFO
#
#

BRUNIE_START=/brunie/system/start
BRUNIE_STOP=/brunie/system/stop
GTM=/usr/gtm

case "$1" in
    start)
	echo "Starting BRUNIE-API"
	su -c "/bin/sh $BRUNIE_START" brunie
	;;
    stop)
	echo "Shutting down BRUNIE-API"
	su -c "/bin/sh $BRUNIE_STOP" brunie
	;;
    try-restart|condrestart)
	if test "$1" = "condrestart"; then
		echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
	fi
	$0 status
	if test $? = 0; then
		$0 restart
	else
		rc_reset	# Not running is not a failure.
	fi
	;;
    restart)
	$0 stop
	$0 start
	;;
    force-reload)
	echo -n "Reload service BRUNIE-API "
	$0 try-restart
	;;
    reload)
	;;
    status)
	echo -n "Checking for service BRUNIE-API "
	checkproc /usr/gtm/mumps
	;;
    probe)
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
	exit 1
	;;
esac
