NIS + question
Hi all,
I have a question regarding NIS+.
We have a script in each NIS+ primary master servers, that rsyncs all tables info from primary master servers to all secondary master servers whenever there is any changes to the tables.
There is a part in the script that checks whether the script is run from primary master server only, and it goes like this :
-------------------------------------------------
my $NISMATCH = "nismatch" ;
my $MASTERTBL = "masters.site_dir.nis.plus.domain" ;
my $master_mark = "M" ;
# If I'm not primary NIS+ master server.
# Script shouldn't start
#
my $master = '' ;
&Logger ("Can\'t execute ${NISMATCH} status=${master_mark} ${MASTERTBL}!" , "ERROR" ) unless
open NISMATCH, "${NISMATCH} -s : status=${master_mark} ${MASTERTBL}|" ;
chomp($master = (<NISMATCH>)[0]) ;
close NISMATCH ;
$master =~ s/:M$// ;
&Logger ("No primary master server found." , "ERROR" ) if "${master}" eq '' ;
exit if ${hostname} !~ /$master/;
}
-------------------------------------------------------
My question is, sometimes the command 'nismatch -s : status=m masters.site_dir.nis.plus.domain' returns nothing, which gives us the No Primary Master server found error. I cant figure out why this is because other times this command works and gives the proper primary master server. Is there any reason/condition/possiblities when this command might not return any value, even if the primary master server is running fine? Usually this issue resolves itself couple of minutes after happening.
Any idea would be helpful. Thanks!
|