Re: scripting doubts

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

 



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
-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux