Debian Codegraph @

server/init/fb-server

raw symbols SCIP
1 #!/bin/sh
2 #
3 # fb-server Frozen-Bubble server
4 #
5 # chkconfig: 2345 99 10
6 # description: this is the Frozen-Bubble server; it allows people to play \
7 # Frozen-Bubble over the Internet.
8 # processname: fb-server
9 # pidfile: /var/run/fb-server.pid
10 # config: /etc/fb-server*.conf
11
12 # Source function library.
13 . /etc/rc.d/init.d/functions
14
15 # Source networking configuration.
16 . /etc/sysconfig/network
17
18 conffiles=/etc/fb-server*.conf
19 servicename=fb-server
20
21 # Check that networking is up.
22 [ ${NETWORKING} = "no" ] && exit 0
23
24 start() {
25 gprintf "Starting Frozen-Bubble server(s): "
26 ATLEASTONE=-1
27 for file in $conffiles; do
28 su -l fbuser -s /bin/sh -c "fb-server -c $file >/dev/null" && success || failure
29 RETVAL=$?
30 if [ "$ATLEASTONE" -ne 0 ]; then
31 ATLEASTONE=$RETVAL
32 fi
33 echo
34 done
35 if [ $ATLEASTONE -eq 0 ]; then
36 touch /var/lock/subsys/$servicename
37 fi
38 return $ATLEASTONE
39 }
40
41 stop() {
42 gprintf "Stopping Frozen-Bubble server(s): "
43 killproc fb-server -TERM
44 RETVAL=$?
45 echo
46 if [ $RETVAL -eq 0 ]; then
47 rm -f /var/lock/subsys/$servicename
48 fi
49 return $RETVAL
50 }
51
52 restart() {
53 stop
54 start
55 }
56
57 # See how we were called.
58 case "$1" in
59 start)
60 start
61 ;;
62 stop)
63 stop
64 ;;
65 restart)
66 stop
67 start
68 ;;
69 status)
70 status fb-server
71 RETVAL=$?
72 ;;
73 condrestart)
74 [ -f /var/lock/subsys/$servicename ] && restart || :
75 ;;
76 *)
77 gprintf "Usage: $servicename {start|stop|restart|status|condrestart}\n"
78 exit 1
79 esac
80
81 exit $?