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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux