#! /bin/sh
#
# This a generated file. DO NOT EDIT THIS FILE!
# If you want to modify how this file works, please
# modify /home/jojo/debian/official/metainit/metainit/etc/metainit/infon-server.metainit and re-run update-metainit.
#
# If you are sure that you want to modify this file,
# remove this comment, and update-metainit will not override
# this script any more.
#
### BEGIN INIT INFO
# Provides:          infon-server
# Default-Start:     
# Default-Stop:      1 2 3 4 5
# Short-Description: infon-server
# Required-Start:   $local_fs $network $remote_fs
# Required-Stop:     $local_fs $network $remote_fs
# Description:       infon-server

### END INIT INFO

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=infon\-server
NAME=infon\-server
DAEMON=/usr/bin/infond
BASENAME=infond
DAEMON_ARGS=
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 5

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
	start-stop-daemon --start --oknodo --background --quiet --make-pidfile --pidfile $PIDFILE --exec $DAEMON -- \
		$DAEMON_ARGS || return 1
}

#
# Function that stops the daemon/service
#
do_stop()
{
	start-stop-daemon --stop --oknodo --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $BASENAME
	RETVAL="$?"

	rm -f $PIDFILE

	return $RETVAL
	return "$RETVAL"
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
	return 0
}

case "$1" in
  start)
	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
	do_start
    log_end_msg $?
	;;
  stop)
	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
	do_stop
    log_end_msg $?
	;;
  #reload|force-reload)
	#
	# If do_reload() is not implemented then leave this commented out
	# and leave 'force-reload' as an alias for 'restart'.
	#
	#log_daemon_msg "Reloading $DESC" "$NAME"
	#do_reload
	#log_end_msg $?
	#;;
  restart|force-reload)
	#
	# If the "reload" option is implemented then remove the
	# 'force-reload' alias
	#
	log_daemon_msg "Restarting $DESC" "$NAME"
	do_stop
	case "$?" in
	  0)
		do_start
        log_end_msg "$?"
		;;
	  *)
	  	# Failed to stop
		log_end_msg 1
		;;
	esac
	;;
  *)
	#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
	exit 3
	;;
esac
