# # $Id: openserctl.fifo 2427 2007-07-10 10:43:58Z henningw $ # # openser control tool for maintaining openser # #=================================================================== ##### ----------------------------------------------- ##### ### FIFO specific variables and functions # ##### ----------------------------------------------- ##### ### load CTL base # if [ -f "$MYLIBDIR/openserctl.ctlbase" ]; then . "$MYLIBDIR/openserctl.ctlbase" else mwarn "Cannot load CTL core functions '$MYLIBDIR/openserctl.ctlbase' ..." # exit -1 fi # ##### ----------------------------------------------- ##### ### parameters # if [ -z "$OSER_FIFO" ]; then OSER_FIFO=/tmp/openser_fifo fi # ##### ----------------------------------------------- ##### ### functions # usage_fifo() { echo mecho " -- command 'fifo'" echo cat < $OSER_FIFO # wait for the reader to complete wait rm $path mdbg "FIFO command was:\n$CMD" } CTLCMD=fifo_cmd fifo_openser_monitor() { name=openser_receiver_$$ path=/tmp/$name if [ ! -w $OSER_FIFO ]; then merr "Error opening OpenSER's FIFO $OSER_FIFO" merr "Make sure you have the line 'modparam(\"mi_fifo\", \"fifo_name\", \"$OSER_FIFO\")' in your config" merr "and also have loaded the mi_fifo module." exit 1 fi mkfifo $path if [ $? -ne 0 ] ; then merr "monitor - error opening read fifo $path" exit 1 fi chmod a+w $path trap "rm $path; clear; echo monitor ^C-ed; exit 1" 2 attempt=0 if [ "$2" = "" ]; then loops=-1; else loops=$2; fi clear while [ $loops -ne $attempt ] ; do attempt=`$EXPR $attempt + 1` #clear tput clear # print_stats $name $path $attempt mecho "[cycle #: $attempt; if constant make sure server lives]" cat < $path | filter_fl & cat > $OSER_FIFO < $OSER_FIFO << EOF :uptime:$name EOF wait echo mecho "Transaction Statistics: " cat < $path | filter_fl & cat > $OSER_FIFO < $OSER_FIFO < $OSER_FIFO <