File: fb-server

package info (click to toggle)
frozen-bubble 2.212-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 31,356 kB
  • ctags: 1,000
  • sloc: perl: 8,572; ansic: 1,200; sh: 92; makefile: 8
file content (81 lines) | stat: -rwxr-xr-x 1,725 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
#
# fb-server      Frozen-Bubble server
#
# chkconfig: 2345 99 10
# description: this is the Frozen-Bubble server; it allows people to play \
#              Frozen-Bubble over the Internet.
# processname: fb-server
# pidfile: /var/run/fb-server.pid
# config: /etc/fb-server*.conf

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

conffiles=/etc/fb-server*.conf
servicename=fb-server

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

start() {
        gprintf "Starting Frozen-Bubble server(s): "
        ATLEASTONE=-1
        for file in $conffiles; do
            su -l fbuser -s /bin/sh -c "fb-server -c $file >/dev/null" && success || failure
            RETVAL=$?
            if [ "$ATLEASTONE" -ne 0 ]; then
                ATLEASTONE=$RETVAL
            fi
            echo
        done
        if [ $ATLEASTONE -eq 0 ]; then
            touch /var/lock/subsys/$servicename
        fi
        return $ATLEASTONE
}

stop() {
        gprintf "Stopping Frozen-Bubble server(s): "
        killproc fb-server -TERM
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ]; then
            rm -f /var/lock/subsys/$servicename
        fi
        return $RETVAL
}

restart() {
        stop
        start
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        start
        ;;
  status)
        status fb-server
        RETVAL=$?
        ;;
  condrestart)
        [ -f /var/lock/subsys/$servicename ] && restart || :
        ;;
  *)
        gprintf "Usage: $servicename {start|stop|restart|status|condrestart}\n"
        exit 1
esac

exit $?