| 1 | #!/bin/shscip-shell filesystem . . `/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/functionsscip-shell source . . `/etc/rc.d/init.d/functions`. |
| 14 | |
| 15 | # Source networking configuration. |
| 16 | . /etc/sysconfig/networkscip-shell source . . `/etc/sysconfig/network`. |
| 17 | |
| 18 | conffiles=/etc/fb-server*.conf |
| 19 | servicename=fb-server |
| 20 | |
| 21 | # Check that networking is up. |
| 22 | [scip-shell system . . `[`. ${NETWORKING} = "no" ] && exit 0 |
| 23 | |
| 24 | startscip-shell shell frozen-bubble 2.212-13 start().() { |
| 25 | gprintf "Starting Frozen-Bubble server(s): " |
| 26 | ATLEASTONE=-1 |
| 27 | for file in $conffiles; do |
| 28 | suscip-shell system . . su. -l fbuser -s /bin/shscip-shell filesystem . . `/bin/sh`. -c "fb-server -c $file >/dev/null" && success || failure |
| 29 | RETVAL=$? |
| 30 | if [scip-shell system . . `[`. "$ATLEASTONE" -ne 0 ]; then |
| 31 | ATLEASTONE=$RETVAL |
| 32 | fi |
| 33 | echoscip-shell system . . echo. |
| 34 | done |
| 35 | if [scip-shell system . . `[`. $ATLEASTONE -eq 0 ]; then |
| 36 | touchscip-shell system . . touch. /var/lock/subsys/$servicename |
| 37 | fi |
| 38 | return $ATLEASTONE |
| 39 | } |
| 40 | |
| 41 | stopscip-shell shell frozen-bubble 2.212-13 stop().() { |
| 42 | gprintf "Stopping Frozen-Bubble server(s): " |
| 43 | killproc fb-server -TERM |
| 44 | RETVAL=$? |
| 45 | echoscip-shell system . . echo. |
| 46 | if [scip-shell system . . `[`. $RETVAL -eq 0 ]; then |
| 47 | rmscip-shell system . . rm. -f /var/lock/subsys/$servicename |
| 48 | fi |
| 49 | return $RETVAL |
| 50 | } |
| 51 | |
| 52 | restartscip-shell shell frozen-bubble 2.212-13 restart().() { |
| 53 | stopscip-shell shell frozen-bubble 2.212-13 stop(). |
| 54 | startscip-shell shell frozen-bubble 2.212-13 start(). |
| 55 | } |
| 56 | |
| 57 | # See how we were called. |
| 58 | case "$1" in |
| 59 | start) |
| 60 | startscip-shell shell frozen-bubble 2.212-13 start(). |
| 61 | ;; |
| 62 | stop) |
| 63 | stopscip-shell shell frozen-bubble 2.212-13 stop(). |
| 64 | ;; |
| 65 | restart) |
| 66 | stopscip-shell shell frozen-bubble 2.212-13 stop(). |
| 67 | startscip-shell shell frozen-bubble 2.212-13 start(). |
| 68 | ;; |
| 69 | status) |
| 70 | status fb-server |
| 71 | RETVAL=$? |
| 72 | ;; |
| 73 | condrestart) |
| 74 | [scip-shell system . . `[`. -f /var/lock/subsys/$servicename ] && restartscip-shell shell frozen-bubble 2.212-13 restart(). || : |
| 75 | ;; |
| 76 | *) |
| 77 | gprintf "Usage: $servicename {start|stop|restart|status|condrestart}\n" |
| 78 | exit 1 |
| 79 | esac |
| 80 | |
| 81 | exit $? |