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
[email protected]
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