scripting doubts

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

 



Hi guys,

I'm trying to create an script to verify some databases and their privileges.

I have all of them in some files with the following format:
server1
server2
server3
server4

Being all of them MySQL servers and the first one the master and the rest of the just the slaves.

I only want to check the privileges in the slaves and I've created the following statement:
for i in `cat file1_cluster`; do echo -n $i: && mysql -h$i -uroot -pwhatever -e"show grants for 'user'@'10.10.%.%';" | grep -i "REPLICATION CLIENT" | wc -l ; done > /tmp/privs

Keep in mind I just want to know the slaves which doesn't have the REPLICATION CLIENT privileges, just that.
So that will write in /tmp/privs something like:
server1:0
server2:1
server3:0

Being the value 0 a machine which doesn't have REPLICATION CLIENT privilege and 1 being the value which mean it does.

The thing is, how can I do the "for" loop to avoid reading the first line of the file: file1_cluster, file2_cluster etc...cause the master will never have replication client privileges.

After reading the /tmp/privs with another for, I will use cut -d ":" -f to look for values distinct from 0 and do a mail -s to the admins.

Any help will be more than appreciated.

Thanks 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