I think ssh is "draining" the input stream, which in this case means the pipeline coming into the while loop.  Try redirecting the ssh input stream from /dev/null:<br><br>      /usr/bin/ssh bwadmin@${MACHINE} "hostname" < /dev/null<br>
<br>I tested that with this command line:<br><br>     ls | while read a; do ssh 192.168.1.4 hostname < /dev/null ; done<br><br>and got back the remote host name once for each file in the local directory.<br><br>Ralph Mitchell<br>
<br><br><div class="gmail_quote">On Thu, Dec 15, 2011 at 4:01 PM, oliver <span dir="ltr"><<a href="mailto:ohemming@gmail.com">ohemming@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I have 6 servers in my hosts.cfg file that use a custom script with a<br>
HOSTTAG of cdr<br>
<br>
The script is located at $XYMONHOME/ext/check_cdr.sh<br>
<br>
If I make it as basic as possible, it all runs perfectly.  For example:<br>
<br>
================================<br>
#!/bin/bash -x<br>
<br>
HOSTTAG=cdr<br>
COLUMN=$HOSTTAG<br>
<br>
$XYMONHOME/bin/xymongrep $HOSTTAG | while read L<br>
do<br>
   set $L       # To get one line of output from xymongrep<br>
   HOSTIP="$1"<br>
   MACHINEDOTS="$2"<br>
   MACHINE=`echo $2 | $SED -e's/\./,/g'`<br>
   COLOR=green<br>
   MSG="running on ${MACHINE}"<br>
   $XYMON $XYMSRV "status $MACHINE.$COLUMN $COLOR `date`<br>
   ${MSG}<br>
   "<br>
done<br>
<br>
exit 0<br>
================================<br>
<br>
I realise the test itself is useless, it's just to demonstrate the problem.<br>
<br>
Since I have the -x on the first line, I see it iterate through all 6<br>
servers in the log file I specified in the tasks.cfg file<br>
<br>
This is part of the output, going from the first server to the second<br>
<br>
+ /apps/xymon/server/bin/xymongrep cdr<br>
+ read L<br>
+ set 10.64.91.99 as1wdc1 '#' cdr<br>
+ HOSTIP=10.64.91.99<br>
+ MACHINEDOTS=as1wdc1<br>
++ echo as1wdc1<br>
++ /usr/bin/sed '-es/\./,/g'<br>
+ MACHINE=as1wdc1<br>
+ COLOR=green<br>
+ MSG='running on as1wdc1'<br>
++ date<br>
+ /apps/xymon/server/bin/xymon 127.0.0.1 'status as1wdc1.cdr green Thu<br>
Dec 15 20:57:41 GMT 2011<br>
   running on as1wdc1<br>
   '<br>
+ read L<br>
+ set 10.64.123.67 as2dal1 '#' cdr<br>
+ HOSTIP=10.64.123.67<br>
+ MACHINEDOTS=as2dal1<br>
<br>
<br>
But if I add the following line to the script,  directly above the<br>
"$XYMON $XYSERVER... " one, I only see the first server get queried<br>
before the script exits and ultimately, my other 5 servers go purple.<br>
<br>
/usr/bin/ssh bwadmin@${MACHINE} "hostname"<br>
<br>
With the ssh line, my last bit of output in the log file is:<br>
<br>
+ /usr/bin/ssh bwadmin@as1wdc1 hostname<br>
AS1WDC1<br>
++ date<br>
+ /apps/xymon/server/bin/xymon 127.0.0.1 'status as1wdc1.cdr green Thu Dec 15 20<br>
:52:37 GMT 2011<br>
   running on as1wdc1<br>
   '<br>
+ read L<br>
+ exit 0<br>
<br>
What is it about the ssh command that causes the "while read L" loop to fail?<br>
<br>
Thanks<br>
_______________________________________________<br>
Xymon mailing list<br>
<a href="mailto:Xymon@xymon.com">Xymon@xymon.com</a><br>
<a href="http://lists.xymon.com/mailman/listinfo/xymon" target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a><br>
</blockquote></div><br>