]> git.pld-linux.org Git - packages/crossfire.git/blame_incremental - crossfire.init
- allow some actions when network is down
[packages/crossfire.git] / crossfire.init
... / ...
CommitLineData
1#!/bin/sh
2#
3# chkconfig: 345 98 03
4# description: Starts and stops the Crossfire server
5#
6
7export 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.
19if is_yes "${NETWORKING}"; then
20 if [ ! -f /var/lock/subsys/network -a != stop -a != status ]; then
21 msg_network_down crossfire
22 exit 1
23 fi
24else
25 exit 0
26fi
27
28TMPDIR="/tmp"; export TMPDIR
29
30RETVAL=0
31case "$1" in
32 start)
33 if [ ! -f /var/lock/subsys/crossfire ]; then
34 cd /
35 FLAGS="-log /var/log/crossfire"
36 if [ -n "$PORT" ]; then
37 FLAGS="$FLAGS -csport $PORT"
38 fi
39 if is_yes "$DEBUG" ; then
40 FLAGS="$FLAGS -d"
41 else
42 FLAGS="$FLAGS +d"
43 fi
44 msg_starting crossfire
45 daemon su games -c "\"exec crossfire -detach $FLAGS >>/var/log/crossfire 2>&1\""
46 RETVAL=$?
47 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crossfire
48 else
49 msg_already_running crossfire
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 fi
60 ;;
61 status)
62 status crossfire
63 RETVAL=$?
64 su games -c "crossfire +d -s"
65 ;;
66 restart)
67 $0 stop
68 $0 start
69 RETVAL=$?
70 ;;
71 reload|force-reload)
72 if [ -f /var/lock/subsys/crossfire ]; then
73 msg_reloading crossfire
74 killproc crossfire
75 RETVAL=$?
76 else
77 msg_not_running crossfire >&2
78 exit 7
79 fi
80 ;;
81 *)
82 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
83 exit 3
84esac
85
86exit $RETVAL
This page took 0.071614 seconds and 4 git commands to generate.