#!/bin/sh
#
# chkconfig: 
# description: Runs the CNRI microscope server.
# processname: server.py

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

case "$1" in
  start)
	echo -n "Starting scope services: "
	cd /usr/local/microscope/server/ ; su scope --command="./server.py &"
	echo 'started'
	touch /var/lock/subsys/microscope
	;;	

  stop)
	echo -n "Shutting down scope services: "
	killall server.py
	echo 'stopped'
	rm -f /var/lock/subsys/microscope
	;;	

  restart|reload)
	$0 stop
	$0 start
	;;

  status)
	status scope
	;;
  *)
	echo "Usage: microscope {start|stop|status|restart|reload}"
	exit 1
esac

exit 0
