scripting doubts

Arthur Meeks Meeks arthur.meeks.luppu at gmail.com
Tue Aug 4 18:04:16 UTC 2009


Thanks all for your questions.

I'm stacked, though in another problem.
I have the script almost done but I'm having a small problem.
I'm doing an "egrep "REPLICATION CLIENT|ALL" | wc -l" after the mysql
-pwhatever -e "show grants for...etc" all this is redirected to a file using
normal ">".
So:
for i in `cat file` do mysql -p -e "show grants etc.." "egrep "REPLICATION
CLIENT|ALL" | wc -l > /tmp/whatever basically.

/tmp/whatever has the following "format":
server1:0
server2:1
server3:0
etc

I use another "for" to read this file and decide whether the database has
the right privileges, if it has REPLICATION CLIENT or ALL privileges, "wc
-l" will return 1 or more than 1, if it doesn't have any of them it will be
a 0.

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.
I tried doing: grep -v "ERROR" and doing a 2> /dev/null after the mysql -p
-e "show grants etc.." but it doesn't work.

Any ideas?

Thanks you all a lot.
A
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/users/attachments/20090804/8c48d6a1/attachment-0001.html 


More information about the users mailing list