#!/bin/bash
#
# chkconfig: - 96 04
# description: mount server
# processname: telescoped
# pidfile: /var/run/telescoped.pid
# config: /etc/sysconfig/telescope
#
# $Id: mount-server.init.redhat,v 1.2 2003-06-20 20:05:43 hroch Exp $
#
### BEGIN INIT INFO
# Provides: telescoped
# Required-Start: network
# Required-Stop:
# Default-Start:
# Default-Stop: 0 1 2 6
# Short-Description: Telescope mount server
# Description: Remote control for telescope from NightView suite
### END INIT INFO

# source function library
. /etc/init.d/functions
[ -e /etc/sysconfig/nightview ] && . /etc/sysconfig/nightview

RETVAL=0

start() {
	echo -n $"Starting telescope daemon: "

  daemon telescoped
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/telescoped
}

stop() {
	echo -n $"Shutting down telescope daemon: "
	killproc telescoped
	RETVAL=$?

	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/telescoped
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	stop
	start
	RETVAL=$?
	;;
  condrestart)
	if [ -f /var/lock/subsys/telescoped ]; then
	    stop
	    start
	    RETVAL=$?
	fi
	;;
  status)
	status telescoped
	RETVAL=$?
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|condrestart|status}"
	exit 1
esac

exit $RETVAL

