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