- allow some actions when network is down
[packages/crossfire.git] / crossfire.init
CommitLineData
9f1d2768
JK
1#!/bin/sh
2#
3# chkconfig: 345 98 03
4# description: Starts and stops the Crossfire server
5#
6
5e31074d 7export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
9f1d2768
JK
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.
83bbb257 19if is_yes "${NETWORKING}"; then
8eb88a18 20 if [ ! -f /var/lock/subsys/network -a != stop -a != status ]; then
83bbb257 21 msg_network_down crossfire
22 exit 1
23 fi
24else
25 exit 0
9f1d2768
JK
26fi
27
28TMPDIR="/tmp"; export TMPDIR
9f1d2768 29
1c995469 30RETVAL=0
9f1d2768 31case "$1" in
3dfe7aae 32 start)
33 if [ ! -f /var/lock/subsys/crossfire ]; then
5e31074d
JK
34 cd /
35 FLAGS="-log /var/log/crossfire"
a08a2baf 36 if [ -n "$PORT" ]; then
5e31074d
JK
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
9f1d2768 44 msg_starting crossfire
5e31074d 45 daemon su games -c "\"exec crossfire -detach $FLAGS >>/var/log/crossfire 2>&1\""
9f1d2768
JK
46 RETVAL=$?
47 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crossfire
3dfe7aae 48 else
49 msg_already_running crossfire
3dfe7aae 50 fi
9f1d2768 51 ;;
3dfe7aae 52 stop)
53 if [ -f /var/lock/subsys/crossfire ]; then
54 msg_stopping crossfire
9f1d2768
JK
55 killproc crossfire
56 rm -f /var/lock/subsys/crossfire >/dev/null 2>&1
3dfe7aae 57 else
83bbb257 58 msg_not_running crossfire
3dfe7aae 59 fi
9f1d2768 60 ;;
3dfe7aae 61 status)
62 status crossfire
1c995469 63 RETVAL=$?
5e31074d 64 su games -c "crossfire +d -s"
9f1d2768
JK
65 ;;
66 restart)
67 $0 stop
68 $0 start
1c995469 69 RETVAL=$?
9f1d2768 70 ;;
1c995469 71 reload|force-reload)
9f1d2768 72 if [ -f /var/lock/subsys/crossfire ]; then
3dfe7aae 73 msg_reloading crossfire
74 killproc crossfire
83bbb257 75 RETVAL=$?
9f1d2768 76 else
1c995469 77 msg_not_running crossfire >&2
78 exit 7
3dfe7aae 79 fi
9f1d2768
JK
80 ;;
81 *)
1c995469 82 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
f161e4ad 83 exit 3
9f1d2768 84esac
3dfe7aae 85
86exit $RETVAL
This page took 0.116453 seconds and 4 git commands to generate.