Hi guys, <br><br>I'm trying to create an script to verify some databases and their privileges.<br><br>I have all of them in some files with the following format:<br>server1<br>server2<br>server3<br>server4<br><br>Being all of them MySQL servers and the first one the master and the rest of the just the slaves.<br>
<br>I only want to check the privileges in the slaves and I've created the following statement:<br>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<br>
<br>Keep in mind I just want to know the slaves which doesn't have the REPLICATION CLIENT privileges, just that.<br>So that will write in /tmp/privs something like:<br>server1:0<br>server2:1<br>server3:0<br><br>Being the value 0 a machine which doesn't have REPLICATION CLIENT privilege and 1 being the value which mean it does.<br>
<br>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.<br><br>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.<br>
<br>Any help will be more than appreciated.<br><br>Thanks a lot<br>A<br>