#!/bin/sh # # mgbrr MaGic BRoker for Red hat # # functions start the magic broker # # version /etc/rc.d/init.d/mgbrr 0.3 (pre.alpha) 06.10.2000 # to be used with red hat # # author klaus-dieter uhlich, kladde # # mailing list: www.egroups.com/groups/magicu-l # # BR_PATH: directory of the magic broker # default is "/usr/magicadm/broker" BR_PATH=/usr/magicadm/broker # BR_USER: get the environment of an user # default is "magicadm". BR_USER=magicadm # # # # # source function library . /etc/rc.d/init.d/functions # # chkconfig: 3 92 91 # description: start the magic broker\ # # set additional messages based on functions # to give more information. # echo_up() { [ "$BOOTUP" = "color" ] && $MOVE_TO_COL echo -n "[ " [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING echo -n "UP" [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL echo -n " ]" echo -ne "\r" return 1 } echo_down() { [ "$BOOTUP" = "color" ] && $MOVE_TO_COL echo -n "[ " [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING echo -n "DOWN" [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL echo -n " ]" echo -ne "\r" return 1 } # # if you are not $BR_USER recall this script with $BR_USER. # if [ "$USER" != "$BR_USER" ] ; then su $BR_USER -c "umask 022; $0 $1" exit $? fi # # test the enviroment variables # if [ ! -f $BR_PATH/mgrqmrb ] ; then echo -n "mgbrr: $BR_PATH/mgrqmrb not found" echo_failure echo exit 1 fi # if [ ! -f $BR_PATH/mgrb.ini ]; then if [ ! -f $BR_PATH/MGRB.INI ]; then echo -n "mgbrr: $BR_PATH/mgrb.ini not found" echo_failure echo exit 2 fi fi # # See how we were called. # RETVAL=0 echo -n "mgbrr service $1:" case "$1" in start) if [ ! -f /var/lock/subsys/mgbrr ]; then cd $BR_PATH $BR_PATH/mgrqmrb -ReusePorts & RETVAL=$? if [ $RETVAL -eq 0 ]; then touch /var/lock/subsys/mgbrr echo_success fi else echo_up fi echo ;; stop) if [ -f /var/lock/subsys/mgbrr ]; then killproc $BR_PATH/mgrqmrb RETVAL=$? rm -f /var/lock/subsys/mgbrr else echo_down fi echo ;; reload|restart) echo $0 stop $0 start RETVAL=$? ;; status) status $BR_PATH/mgrqmrb RETVAL=$? ;; *) echo echo "Usage: $0 {start|stop|restart|reload|status}" exit 1 esac exit $RETVAL