neutron.sh
author Mikael Berthe <mikael@lilotux.net>
Thu, 03 May 2007 22:41:58 +0200
changeset 34 535d03a56f9d
parent 0 93b25987d3e5
permissions -rwxr-xr-x
Improve DICT module readbility

#!/bin/bash

NEUTRON=./neutron.py

PIDPATH=.
PIDFILE=$PIDPATH/neutron.pid

case "$1" in
  start)
	echo -n "Starting Neutron: "
	if ([[ -w $PIDFILE ]])
	then 
		echo "ERROR: Neutron already started (PID file found)"
		exit 1
	fi
	$NEUTRON --pid=$PIDFILE >/dev/null &
	echo "done"
    ;;
  stop)
	echo -n "Stopping Neutron: "
	if !([[ -w $PIDFILE ]])
	then 
		echo "ERROR: Neutron is not running (PID file not found)"
		exit 1
	fi
	kill `cat $PIDFILE`
	rm $PIDFILE
	echo "done"
    ;;
  *)
    echo "Usage: $0 {start|stop}" >&2
    exit 1
    ;;
esac

exit 0