2009/8/6 Cameron Simpson <cs@xxxxxxxxxx>
Seems to work like a charm!
Thanks a lot Cameron!
A
On 05Aug2009 09:52, Arthur Meeks Meeks <arthur.meeks.luppu@xxxxxxxxx> wrote:
| 2009/8/5 Cameron Simpson <cs@xxxxxxxxxx>
| > On 04Aug2009 20:04, Arthur Meeks Meeks <arthur.meeks.luppu@xxxxxxxxx>
| > wrote:
| > | What's the problem? When I can't log into a mysql database (mostly
| > | cause it is down) I got a "0", what I want is to discard these
| > | machines, so they're not included in /tmp/whatever.
| >
| > You're probably not getting to pay attention to the mysql exit status.[...]
| > mysql -h "$host" -ublah -pfhfhfhfhf -e "show grants..." >"$grants" \
| > || { echo "skipping $host, maybe down" >&2
| > continue
| > }
| > egrep ......... <"$grants" | wc -l ...
|
| Hi Cameron,Like this (untested):
| First off, thanks a lot.
| I've been trying to include those lines in my script without modifying it
| too much but it wasn't possible.
| How would you include your piece of code to this script:
|
| #!/bin/bash
| PASS="fff"
| LIST="/tmp/perms"
|
| for i in `cat /opt/lists/*clusters`; do echo -n $i: && mysql -h$i -uroot
| -p$PASS -e"show grants for 'user'@'10.10.%.%';" | egrep "REPLICATION
| CLIENT|ALL" | wc -l ; done > $LIST
mysql "-h$i" -uroot "-p$PASS" -e"show grants for 'user'@'10.10.%.%';" >mysql.out || continue
for i in `cat /opt/lists/*clusters`
do
echo -n $i:; egrep "REPLICATION CLIENT|ALL" <mysql.out | wc -l
done >"$LIST"
Seems to work like a charm!
Thanks a lot Cameron!
A
-- fedora-list mailing list fedora-list@xxxxxxxxxx To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines