[Samba] samba4 check database replication script. samba-check-db-repl.sh

Rowland Penny rowlandpenny at googlemail.com
Mon Mar 23 10:21:00 MDT 2015


On 23/03/15 10:31, L.P.H. van Belle wrote:
> Hai,
>   
> I have created a new script for checking samba DC database replications.
>   
> I have tested with 2 DC's , if there people with more than 2 DCs, and want to test for me, would be great.
> I tested on debian wheezy, but should work on any apt-get capable os.  ( but not tested )
>   
>
> What it does..
> - auto detects the DC in you network.
> - detects the DC met FSMO roles and compairs this db with all other DC's.
>      ( based on : 1 DC is running all the FSMO roles )
> - compaires with different settings.
>      samba-tool drs showrepl and  samba-tool ldapcmp --filter="whenChanged"
> - you can set these check on or off per check.
> - automatic checks for needed programs and installs when not found.
> - installs all needed programs without any questions asked.
>
> - e-mail reporting when errors are found.  ( default only on errors found )
> - if no sendmail program is found, installs postfix and sets relayhost for you if needed.
>      postfix wil be running on localhost only
>      relayhost is not needed if you have a "correct" dns setup.
> - can run as cron job, if administrator password is suppied in the script.
> - run it without email address for console output only
> - asks for Administrator password if not supplied in the script.
> - colored output on console.
> - can run by change-ing only the "CONFIGURED=no" to yes
>
>   
>   
> get it here:
> wget --no-check-certificate https://secure.bazuin.nl/scripts/samba-check-db-repl.sh
>   
>
> Let me know what you think of this one..
> Suggestions are always welkom.
>   
>   
> Greetz,
>   
> Louis
>   
>   

Hi Louis, I am having a look at your script and I am sorry to say I have 
found a bug =-O

Line 124:

if [ "${SAMBA_CHECKDB_WITH_DRS}" = "no" ] || [ 
"${SAMBA_CHECKDB_WITH_LDAPCMP}" = "no" ] ; then

Should be:

if [ "${SAMBA_CHECKDB_WITH_DRS}" = "no" ] && [ 
"${SAMBA_CHECKDB_WITH_LDAPCMP}" = "no" ] ; then

The way it is written means that if either of the two variables is set 
to 'no', the script will print the error message and exit, I think you 
meant if both are set to 'no'

Rowland


More information about the samba mailing list