]> git.pld-linux.org Git - packages/crossfire.git/blob - crossfire.init
- updated
[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_no "${NETWORKING}"; then
20         msg_network_down crossfire
21         exit 1
22 fi
23
24 TMPDIR="/tmp"; export TMPDIR
25
26 case "$1" in
27   start)
28         if [ ! -f /var/lock/subsys/crossfire ]; then
29                 cd /
30                 FLAGS="-log /var/log/crossfire"
31                 if [ -n "$PORT" ] ; then
32                         FLAGS="$FLAGS -csport $PORT"
33                 fi
34                 if is_yes "$DEBUG" ; then
35                         FLAGS="$FLAGS -d"
36                 else
37                         FLAGS="$FLAGS +d"
38                 fi
39                 msg_starting crossfire
40                 daemon su games -c "\"exec crossfire -detach $FLAGS >>/var/log/crossfire 2>&1\"" 
41                 RETVAL=$?
42                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crossfire
43         else
44                 msg_already_running crossfire
45                 exit 1
46         fi
47         ;;
48   stop)
49         if [ -f /var/lock/subsys/crossfire ]; then
50                 msg_stopping crossfire
51                 killproc crossfire
52                 rm -f /var/lock/subsys/crossfire >/dev/null 2>&1
53         else
54                 msg_Not_Running crossfire
55                 exit 1
56         fi
57         ;;
58   status)
59         status crossfire
60         su games -c "crossfire +d -s"
61         exit $?
62         ;;
63   restart)
64         $0 stop
65         $0 start
66         ;;
67   reload)
68         if [ -f /var/lock/subsys/crossfire ]; then
69                 msg_reloading crossfire
70                 killproc crossfire
71         else
72                 msg_not_running crossfire
73                 exit 1
74         fi
75         ;;
76   *)
77         msg_Usage "$0 {start|stop|restart|reload|status}"
78         exit 1
79 esac
80
81 exit $RETVAL
This page took 0.123987 seconds and 3 git commands to generate.