[Samba] old script question

L.P.H. van Belle belle at bazuin.nl
Fri Jan 23 06:36:50 MST 2015


for the second DC, if it installed without problems, then i can assure you, your DC2 works ok. ;-) 

I do run these on my DC1 to check the databases between the DC's 

check-DB-ldapcmp.sh 
#!/bin/sh

## the email adress to report to.
SETMAILREPORT=some at emailadres.tld

## First DC ( hostname or ipadres )
SETDCFSMO="dc1"
## Second DC ( hostname or ipadres more then 2 DC's, separated by space )
SETOTHERDCS="dc2"

# if needed add more options to filter out. 
# this depends on the samba version your using. 
SETFILTEROPTIONS="whenChanged"

SETSAMBATOOLS=`which samba-tool`
SETREMOVELOG=yes

for x in $SETOTHERDCS ; do 
    $SETSAMBATOOLS ldapcmp --filter="${SETFILTEROPTIONS}" ldap://$SETDCFSMO ldap://$x  -d0 2>&1 >> /tmp/samba_ldapcmp_checkdb
    if grep -q FAILURE /tmp/samba_ldapcmp_checkdb; then
       cat /tmp/samba_ldapcmp_checkdb | mail -s "FAILURE ldapcmp between $SETDCFSMO and $SETOTHERDCS" $SETMAILREPORT
    fi
    if [ $SETREMOVELOG = yes ]; then
	rm /tmp/samba_ldapcmp_checkdb
    fi
done

and i use: 
check-DB-showrepl.sh
#!/bin/sh

## the email adress to report to.
SETMAILREPORT=some at emailadres.tld

## First DC ( hostname or ipadres )
SETDCFSMO="dc1"
## Second DC ( hostname or ipadres more then 2 DC's, separated by space )
SETOTHERDCS="dc2"

## you need to check 1 time manualy to see the expected successes. 
## 
expected_failure=0
expected_success=10

SETSAMBATOOLS=`which samba-tool`
SETREMOVELOG=yes

############## 

$SETSAMBATOOLS drs showrepl -d0 2>&1 > /tmp/samba_ldapcmp_showrepl

failure=$(grep -c "failed" /tmp/samba_ldapcmp_showrepl)
success=$(grep -c "successful" /tmp/samba_ldapcmp_showrepl)

for x in $SETOTHERDCS ; do 
    if [ $failure -ne $expected_failure ]; then
        cat /tmp/samba_ldapcmp_showrepl | mail -s "FAILURE: unexpected showrepl result between $SETDCFSMO and $SETOTHERDCS" $SETMAILREPORT
        echo "failures don't match"
    fi
 
    if [ $success -ne $expected_success ]; then
        cat /tmp/samba_ldapcmp_showrepl | mail -s "FAILURE: unexpected showrepl result between $SETDCFSMO and $SETOTHERDCS" $SETMAILREPORT
        echo "successes don't match"
    fi
 
    if [ $failure -eq $expected_failure ] && [ $success -eq $expected_success ]; then
        echo "all is well"
    fi
done

if [ $SETREMOVELOG = yes ]; then
    rm /tmp/samba_ldapcmp_showrepl
fi

Greetz, 

Louis


>-----Oorspronkelijk bericht-----
>Van: bob at donelsontrophy.net 
>[mailto:samba-bounces at lists.samba.org] Namens Bob of Donelson Trophy
>Verzonden: vrijdag 23 januari 2015 14:16
>Aan: SAMBA MailList
>Onderwerp: [Samba] old script question
>
> 
>
>Louis, 
>
>Just wanted to say 'thanks' for your work. 
>
>I just ran your "old script' (to create a DC02) yesterday so I am
>familiar with it's content. The (old) script appeared to have processed
>okay and the DC02 appeared as a 'computer' when I checked thru ADUC on
>my W7 client. Any other tests you'd suggest to confirm the DC02 is
>operating properly? 
>
>(About the new scripts. I read through them this morning and I 
>like what
>I see. Yes, more detailed but, you did a great job (of course) with the
>comments.) 
>
>-- 
>
>-------------------------
>
>Bob Wooden of Donelson Trophy
>
>615.885.2846 (main)
>www.donelsontrophy.com [1]
>
>"Everyone deserves an award!!"
> 
>
>Links:
>------
>[1] http://www.donelsontrophy.com
>-- 
>To unsubscribe from this list go to the following URL and read the
>instructions:  https://lists.samba.org/mailman/options/samba
>
>



More information about the samba mailing list