]>
Commit | Line | Data |
---|---|---|
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 | |
10 | ||
11 | # Get service config | |
12 | [ -f /etc/sysconfig/wesnothd ] && . /etc/sysconfig/wesnothd | |
13 | ||
14 | start() { | |
15 | if [ ! -f /var/lock/subsys/wesnothd ]; then | |
16 | msg_starting wesnothd | |
17 | daemon --user wesnothd --fork '/usr/bin/wesnothd -p 14999 > /dev/null 2>&1' | |
18 | RETVAL=$? | |
19 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/wesnothd | |
20 | else | |
21 | msg_already_running wesnothd | |
22 | fi | |
23 | } | |
24 | ||
25 | stop() { | |
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 | |
33 | } | |
34 | ||
35 | RETVAL=0 | |
36 | case "$1" in | |
37 | start) | |
38 | start | |
39 | ;; | |
40 | stop) | |
41 | stop | |
42 | ;; | |
43 | status) | |
44 | status wesnothd | |
45 | exit $? | |
46 | ;; | |
47 | restart|force-reload) | |
48 | stop | |
49 | start | |
50 | ;; | |
51 | *) | |
52 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
53 | exit 3 | |
54 | esac | |
55 | ||
56 | exit $RETVAL |