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

Rowland Penny rowlandpenny at googlemail.com
Tue Mar 24 04:09:26 MDT 2015


On 24/03/15 07:46, L.P.H. van Belle wrote:
> Darn.. and i did really my best to put on online without any bugs..
> Still learning ... it gets better..
> Thanks you fof having a look, i changed the code...
>
> And what do you think usable for the public?
>
> Greetz,
>
> Louis
>
>
>
>
>> -----Oorspronkelijk bericht-----
>> Van: rowlandpenny at googlemail.com
>> [mailto:samba-bounces at lists.samba.org] Namens Rowland Penny
>> Verzonden: maandag 23 maart 2015 17:21
>> Aan: samba at lists.samba.org
>> Onderwerp: Re: [Samba] samba4 check database replication
>> script. samba-check-db-repl.sh
>>
>> 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
>> -- 
>> To unsubscribe from this list go to the following URL and read the
>> instructions:  https://lists.samba.org/mailman/options/samba
>>
>>

Hi Louis, it should be very usefull, I know I will be using it in 
future. Just one or two little nit-picks :-)

You do realise that '! -z' is the same as '-n' ?

I also altered this:

if [ "${EMAIL_REPORT_ALWAYS}" = "yes" ]; then

to this:

if [ "${EMAIL_REPORT_ALWAYS}" = "yes" ] && [ -n 
"${EMAIL_REPORT_ADDRESS}" ]; then

Just a bit more error checking in case somebody wants to always send 
emails and doesn't add an email address.

Otherwise a very good script.

Rowland



More information about the samba mailing list