]>
Commit | Line | Data |
---|---|---|
8e143102 | 1 | #!/bin/sh |
2 | # | |
3 | # chkconfig: 345 90 12 | |
4 | # description: wesnothd games server | |
5 | # | |
6 | # wesnothd wesnothd server | |
7 | ||
8 | # Source function library | |
9 | . /etc/rc.d/init.d/functions | |
7a354a29 | 10 | |
8e143102 | 11 | # Get service config |
12 | [ -f /etc/sysconfig/wesnothd ] && . /etc/sysconfig/wesnothd | |
13 | ||
ade5efc6 | 14 | start() { |
8e143102 | 15 | if [ ! -f /var/lock/subsys/wesnothd ]; then |
16 | msg_starting wesnothd | |
9cd12597 | 17 | daemon --user wesnothd --fork '/usr/bin/wesnothd -p 14999 > /dev/null 2>&1' |
8e143102 | 18 | RETVAL=$? |
19 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/wesnothd | |
20 | else | |
21 | msg_already_running wesnothd | |
22 | fi | |
ade5efc6 ER |
23 | } |
24 | ||
25 | stop() { | |
8e143102 | 26 | if [ -f /var/lock/subsys/wesnothd ]; then |
27 | msg_stopping wesnothd | |
28 | killproc wesnothd | |
29 | rm /var/lock/subsys/wesnothd | |
30 | else | |
31 | msg_not_running wesnothd | |
32 | fi | |
ade5efc6 ER |
33 | } |
34 | ||
35 | RETVAL=0 | |
36 | case "$1" in | |
37 | start) | |
38 | start | |
39 | ;; | |
40 | stop) | |
41 | stop | |
8e143102 | 42 | ;; |
43 | status) | |
44 | status wesnothd | |
45 | exit $? | |
46 | ;; | |
47 | restart|force-reload) | |
ade5efc6 ER |
48 | stop |
49 | start | |
8e143102 | 50 | ;; |
51 | *) | |
52 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
53 | exit 3 | |
54 | esac | |
7a354a29 | 55 | |
8e143102 | 56 | exit $RETVAL |