File: cyphesis-cpp.init

package info (click to toggle)
cyphesis-cpp 0.5.16-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 5,084 kB
  • ctags: 3,627
  • sloc: cpp: 30,418; python: 4,812; xml: 4,674; sh: 4,118; makefile: 902; ansic: 617
file content (71 lines) | stat: -rw-r--r-- 1,365 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
#
# start/stop cyphesis-cpp game server
#
### BEGIN INIT INFO
# Provides: cyphesis-cpp
# Required-Start: $syslog
# Required-Stop: $syslog
# 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

case "$1" in
    start)
	echo -n "Starting cyphesis games server:"
	start-stop-daemon --start --quiet --chuid cyphesis --exec /usr/bin/cyphesis -- --cyphesis:daemon=true
	if test "$?" = "0" ;
	then
	    echo -n " cyphesis"
	else
	    echo -n " failed"
	fi
	echo "."
	;;
    stop)
	echo -n "Stopping cyphesis games server:"
	kill -SIGTERM `ps ax | grep "/usr/bin/cyphesis" | grep -v 'grep ' | awk '{print $1}'`
	
	if test "$?" != "0" ; then
	    echo -n " failed"
	else
	    echo -n " cyphesis"
	fi
	echo "."
	;;
    reload)
        $0 restart
	;;
    force-reload)
        $0 restart
        ;;
    restart)
	echo -n "Restarting cyphesis games server:"
	echo -n " cyphesis"
	$0 stop
	$0 start
	echo "."
	;;
    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