File debian.cyphesis.init of Package cyphesis

#!/bin/sh
#
# start/stop cyphesis-cpp game server
#
### BEGIN INIT INFO
# Provides: cyphesis-cpp
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: postgresql
# Should-Stop: postgresql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Game-Server of the WorldForge project
# Description: Game-Server of the WorldForge project
### END INIT INFO

if ! [ -f /etc/cyphesis/cyphesis.vconf ]; then
	exit 0
fi

if ! [ -x /usr/bin/cyphesis ]; then
	exit 0
fi

. /lib/lsb/init-functions

case "$1" in
    start)
		log_daemon_msg "Starting cyphesis games server"
		if start-stop-daemon --start --quiet --oknodo --chuid Cyphesis --exec /usr/bin/cyphesis -- --cyphesis:daemon=true 2>/dev/null ; then
			log_end_msg 0
		else
			log_end_msg 1
		fi
		;;
    stop)
		log_daemon_msg "Stopping cyphesis games server"
		PID=`ps ax | grep "/usr/bin/cyphesi[s]" | awk '{print $1}'`
		if [ -z "$PID" ] ; then
			log_progress_msg "(not running)"
			log_end_msg 0
		elif kill -TERM $PID ; then
			log_end_msg 0
		else
			log_progress_msg "(failed to stop)"
			log_end_msg 1
		fi
		;;
    reload)
        $0 restart
		;;
    force-reload)
        $0 restart
        ;;
    restart)
		$0 stop
		$0 start
	;;
    status)
    	/usr/bin/cycmd localhost stat
	;;
	    *)
		echo "Usage: /etc/init.d/cyphesis-cpp {start|stop|reload|force-reload|restart|status}"
		exit 1
	;;
esac

exit 0

openSUSE Build Service is sponsored by