Blob Blame History Raw
#!/bin/bash
#
# globus-gatekeeper
#
# chkconfig: - 20 80
# description: Controls the globus-gatekeeper
#
### BEGIN INIT INFO
# Provides:          globus-gatekeeper
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Stop:      0 1 2 3 4 5 6
# Short-Description: Globus Gatekeeper
# Description:       Globus Gatekeeper
### END INIT INFO

# source function library
. /etc/init.d/functions

sbindir="/usr/sbin"
sysconfdir="/etc"
localstatedir="/var"

rc=0
conf=${sysconfdir}/globus-gatekeeper.conf
pidfile=${localstatedir}/run/globus-gatekeeper.pid
gatekeeper=${sbindir}/globus-gatekeeper

start() {
	echo -n "Starting globus-gatekeeper: "
	if [ ! -f $conf ]; then
	  cp $conf.default $conf;
	fi

	$gatekeeper -c $conf
	rc=$?

	[ $rc -eq 0 ] && success || failure
	[ $rc -eq 0 ] && touch /var/lock/subsys/globus-gatekeeper

	echo
	return $rc
}

stop() {
	echo -n "Stopping globus-gatekeeper: "
	killall -s INT $gatekeeper 2>/dev/null
	rc=$?
	sleep 2
	killall -s KILL $gatekeeper 2>/dev/null

	[ $rc -eq 0 ] && success || failure
	[ $rc -eq 0 ] && rm /var/lock/subsys/globus-gatekeeper

	echo
	return $rc
}

restart() {
	stop
	start
}

case "$1" in
    start)
	start
	;;
    stop)
	stop
	;;
    status)
	;;
    restart | force-reload)
	restart
	;;
    condrestart | try-restart)
	[ -e /var/lock/subsys/globus-gatekeeper ] && restart
	;;
    reload)
	;;
    *)
	echo "Usage: $0 {start|stop|status|restart|force-reload|condrestart|try-restart|reload}"
	exit 1
	;;
esac
exit $rc