<br><br><div class="gmail_quote">2009/8/6 Cameron Simpson <span dir="ltr">&lt;<a href="mailto:cs@zip.com.au">cs@zip.com.au</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On 05Aug2009 09:52, Arthur Meeks Meeks &lt;<a href="mailto:arthur.meeks.luppu@gmail.com">arthur.meeks.luppu@gmail.com</a>&gt; wrote:<br>
| 2009/8/5 Cameron Simpson &lt;<a href="mailto:cs@zip.com.au">cs@zip.com.au</a>&gt;<br>
| &gt; On 04Aug2009 20:04, Arthur Meeks Meeks &lt;<a href="mailto:arthur.meeks.luppu@gmail.com">arthur.meeks.luppu@gmail.com</a>&gt;<br>
| &gt; wrote:<br>
</div><div class="im">| &gt; | What&#39;s the problem? When I can&#39;t log into a mysql database (mostly<br>
| &gt; | cause it is down) I got a &quot;0&quot;, what I want is to discard these<br>
| &gt; | machines, so they&#39;re not included in /tmp/whatever.<br>
| &gt;<br>
</div><div class="im">| &gt; You&#39;re probably not getting to pay attention to the mysql exit status.<br>
</div>[...]<br>
<div class="im">| &gt;    mysql -h &quot;$host&quot; -ublah -pfhfhfhfhf -e &quot;show grants...&quot; &gt;&quot;$grants&quot; \<br>
| &gt;    || { echo &quot;skipping $host, maybe down&quot; &gt;&amp;2<br>
| &gt;         continue<br>
| &gt;       }<br>
| &gt;    egrep ......... &lt;&quot;$grants&quot; | wc -l ...<br>
|<br>
</div><div class="im">| Hi Cameron,<br>
| First off, thanks a lot.<br>
| I&#39;ve been trying to include those lines in my script without modifying it<br>
| too much but it wasn&#39;t possible.<br>
| How would you include your piece of code to this script:<br>
|<br>
| #!/bin/bash<br>
| PASS=&quot;fff&quot;<br>
| LIST=&quot;/tmp/perms&quot;<br>
|<br>
| for i in `cat /opt/lists/*clusters`; do echo -n $i: &amp;&amp; mysql -h$i -uroot<br>
| -p$PASS -e&quot;show grants for &#39;user&#39;@&#39;10.10.%.%&#39;;&quot; | egrep &quot;REPLICATION<br>
| CLIENT|ALL&quot; | wc -l ; done &gt; $LIST<br>
<br>
</div>Like this (untested):<br>
<div class="im"><br>
for i in `cat /opt/lists/*clusters`<br>
do<br>
</div>  mysql &quot;-h$i&quot; -uroot &quot;-p$PASS&quot; -e&quot;show grants for &#39;user&#39;@&#39;10.10.%.%&#39;;&quot; &gt;mysql.out || continue<br>
  echo -n $i:; egrep &quot;REPLICATION CLIENT|ALL&quot; &lt;mysql.out | wc -l<br>
done &gt;&quot;$LIST&quot;</blockquote><div><br>Seems to work like a charm!<br>Thanks a lot Cameron!<br><br>A <br></div></div><br>