[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: distributed directories

On 14 Apr 2004 at 11:19, Donn Cave wrote:
> Are the greps and awks supposed to get the names of the replica hosts
> out of the master conf?  Yours don't actually work for me,  but I think
> that's because my replica statements are different than yours - mine are
> like:  replica   uri=ldap://host.domain.  So something like this -
>    for replica in $(awk -F/ '/replica[ \t]/ { print $NF }' < slapd.conf)
>    do
>        echo updating slapd.conf on $replica >&2
>        ssh $replica "sed 's/a/x/g;s/b/y/g' < oldfile > newfile; install  
> newfile"
>    done

 Yup, right, I parsed everything before the colon (:) and then grabbed 
everything after the equal (=), because I have host=name:socket instead of 
uri=ldap:name (which throws an extra colon in there).

 The grep just gets all replica lines that haven't been commented out.

 I suppose I should have grabbed the replica name with a backreference to a 
regex instead of all the grep and gawk slop, but I just used the first thing I 
thought of.  I dumped the bash commands to a file before executing them so I 
could eyeball them before reaching the point of no return.

 I have a script that lets me reload any number of replicas with a single 
command, regardless of versions and backends (all hail the power and glory of 
slapadd!).  It can rsync the schema at the same time.  But when I did the samba 
upgrade, I needed to modify my ACLs and indexes in slapd.conf, which my script 
does not do.