BB Unix Network Monitor - Message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

{bb} bb-ntp-1_4.sh bug & solution



Hello Brothers,

I've installed bb-ntp-1_4.sh and this is a nice script to check our NTP
services.
When I installed the script in the run once /test many mode and it
failed on tree points.
I made a solution for all of the bugs.
Hopefully will help this bug report to create a next version.

The specs of the running machine:

	<root@xxxx> uname -a
	SunOS xxxx 5.8 Generic_117350-18 sun4u sparc SUNW,Ultra-5_10
	
	Bigbrother version 1.9c

Here are my "bugs & solutions"

---- OLD ----
   254  elif [ "$RUN_FROM_ONE_HOST" = "Y" ]; then
   255
   256    $GREP -e ^[0-9] $BBHOSTS | $GREP "$TEST" |
   257    while read line
   258    do
   259      set $line
   260      HOSTIP=${1}
   261      if test "${HOSTIP}" == "0.0.0.0"
   262      then
   263              HOSTIP=${2}
   264      fi
---- \OLD ----

-----
Bug 1 & 2:
Line 256 has problems with the pattern file.
Line 256 grasp nntp services too.

BBOUT:

Tue Apr 26 15:01:30 2005 bb-ntp.sh /usr/bin/grep: illegal option -- e
Tue Apr 26 15:01:30 2005 bb-ntp.sh Usage: grep -hblcnsviw pattern file .
. .
Tue Apr 26 15:01:30 2005 bb-ntp.sh
/usr/local/bigbrother/bb19c/ext/bb-ntp.sh: [0-9]: not found

Problem 1 & 2 :
The shell had some strange problems expanding variables and interpreting
patterns.
Nntp is cached too with the grep ntp.

Solution 1 & 2: 

Replace L256    with

OLD	:	$GREP -e ^[0-9] $BBHOSTS | $GREP "$TEST" |
NEW	:	$EGREP -e \^\[0-9\] $BBHOSTS | $SED 's/nntp//' | $GREP
$TEST |

Egrep has no problems with the -e (strange problem) and the \ helps to
interpret the pattern string and not to interpret it as an test
operator.
$SED 's/nntp//' filters the nntp out before the $GREP $TEST

-----
Bug 3:
Line 261 has the wrong test operator

Problem 3 :
The == is an arrhythmic test operator.

Solution 3 :
Use = instead of ==
Replace L261      

OLD	:	if test "${HOSTIP}" == "0.0.0.0"
NEW	:	if test "${HOSTIP}" = "0.0.0.0"

The new section will now looks like this.

---- new ----
254  elif [ "$RUN_FROM_ONE_HOST" = "Y" ]; then
   255
   256    $EGREP -e \^\[0-9\] $BBHOSTS | $SED 's/nntp//' | $GREP "$TEST"
|
   257    while read line
   258    do
   259      set $line
   260      HOSTIP=${1}
   261      if test "${HOSTIP}" == "0.0.0.0"
   262      then
   263              HOSTIP=${2}
   264      fi

---- \new ----

-- 
Met vriendelijke groet,

Michel van de Visser	
	Beheer UNIX systemen
	Concerndienst Automatisering
	Universitair Medisch Centrum Utrecht
	email  "M.vandeVisser" + "@" + "umcutrecht.nl" 

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.


Home | Main Index | Thread Index