- cleaning
[packages/crossfire.git] / crossfire.init
1 #!/bin/sh
2 #
3 # chkconfig:    345 98 03
4 # description:  Starts and stops the Crossfire server 
5 #
6
7 export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
8
9 # Source function library.
10 . /etc/rc.d/init.d/functions
11
12 # Source networking configuration.
13 . /etc/sysconfig/network
14
15 # Demon specified configuration.
16 . /etc/sysconfig/crossfire
17
18 # Check that networking is up.
19 if is_yes "${NETWORKING}"; then
20         if [ ! -f /var/lock/subsys/network ]; then
21                 msg_network_down crossfire
22                 exit 1
23         fi
24 else
25         exit 0
26 fi
27
28 TMPDIR="/tmp"; export TMPDIR
29
30 case "$1" in
31   start)
32         if [ ! -f /var/lock/subsys/crossfire ]; then
33                 cd /
34                 FLAGS="-log /var/log/crossfire"
35                 if [ -n "$PORT" ] ; then
36                         FLAGS="$FLAGS -csport $PORT"
37                 fi
38                 if is_yes "$DEBUG" ; then
39                         FLAGS="$FLAGS -d"
40                 else
41                         FLAGS="$FLAGS +d"
42                 fi
43                 msg_starting crossfire
44                 daemon su games -c "\"exec crossfire -detach $FLAGS >>/var/log/crossfire 2>&1\"" 
45                 RETVAL=$?
46                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crossfire
47         else
48                 msg_already_running crossfire
49                 exit 1
50         fi
51         ;;
52   stop)
53         if [ -f /var/lock/subsys/crossfire ]; then
54                 msg_stopping crossfire
55                 killproc crossfire
56                 rm -f /var/lock/subsys/crossfire >/dev/null 2>&1
57         else
58                 msg_not_running crossfire
59                 exit 1
60         fi
61         ;;
62   status)
63         status crossfire
64         su games -c "crossfire +d -s"
65         exit $?
66         ;;
67   restart)
68         $0 stop
69         $0 start
70         ;;
71   reload)
72         if [ -f /var/lock/subsys/crossfire ]; then
73                 msg_reloading crossfire
74                 busy
75                 killproc crossfire
76                 RETVAL=$?
77                 [ $RETVAL -eq 0 ] && ok || died
78         else
79                 msg_not_running crossfire
80                 exit 1
81         fi
82         ;;
83   *)
84         msg_usage "$0 {start|stop|restart|reload|status}"
85         exit 1
86 esac
87
88 exit $RETVAL
This page took 0.069966 seconds and 3 git commands to generate.