fix detecting shared libpython
[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                 if is_yes "$STAT_LOSS_ON_DEATH" ; then
40                         FLAGS="$FLAGS -stat_loss_on_death"
41                 else
42                         FLAGS="$FLAGS +stat_loss_on_death"
43                 fi
44                 if is_yes "$BALANCED_STAT_LOSS" ; then
45                         FLAGS="$FLAGS -balanced_stat_loss"
46                 else
47                         FLAGS="$FLAGS +balanced_stat_loss"
48                 fi
49                 if is_yes "$USE_PERMANENT_EXPERIENCE" ; then
50                         FLAGS="$FLAGS -use_permanent_experience"
51                 else
52                         FLAGS="$FLAGS +use_permanent_experience"
53                 fi
54         
55                 msg_starting crossfire
56                 daemon su games -c "\"exec crossfire -detach $FLAGS >>/var/log/crossfire 2>&1\"" 
57                 RETVAL=$?
58                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crossfire
59         else
60                 msg_Already_Running crossfire
61                 exit 1
62         fi
63         ;;
64     stop)
65         if [ -f /var/lock/subsys/crossfire ]; then
66                 msg_stopping crossfire
67                 killproc crossfire
68                 rm -f /var/lock/subsys/crossfire >/dev/null 2>&1
69         else
70                 msg_Not_Running crossfire
71                 exit 1
72         fi
73         ;;
74    status)
75         status crossfire
76         su games -c "crossfire +d -s"
77         exit $?
78         ;;
79   restart)
80         $0 stop
81         $0 start
82         ;;
83   reload)
84         if [ -f /var/lock/subsys/crossfire ]; then
85                 msg_reloading crossfire
86                 killproc crossfire
87         else
88                 msg_Not_Running crossfire
89                 exit 1
90         fi
91         ;;
92   *)
93         msg_Usage "$0 {start|stop|restart|reload|status}"
94         exit 1
95 esac
This page took 0.03936 seconds and 3 git commands to generate.