[Samba] restarting samba using a cron job on Debian

George jorgito1412 at gmail.com
Mon Nov 30 21:05:36 UTC 2015


The same happens to me on Debian 7 with the included Samba 4.1.17.

Although relates to Ubuntu, this is the same issue:
https://bugs.launchpad.net/ubuntu/+source/samba/+bug/1357471

I can tell you that what triggers this are network connectivity issues
between the DCs, even if they last a couple of seconds. Once the
connectivity is restored, the replication stays broken unless Samba is
restarted.

I have recently compiled 4.3.1 and the related libraries from Experimental
and will give it a shot soon, we'll see if it behaves in the same way. I'll
keep you posted.

You can also use this little script as a workaround, run frequently via
cron (provided by Marco van Zwetselaar). Will check if replication is
broken and restart the service accordingly.

-----

#!/bin/sh
#
# check-samba-ad-dc.sh
#
#   Stop gap measure to restart the Samba AD DC on WERR_CONNECTION_REFUSED
#     https://bugs.launchpad.net/ubuntu/+source/samba/+bug/1357471
#     https://bugzilla.samba.org/show_bug.cgi?id=11164

TMPFILE="/tmp/$(basename "$0").$$"

if ! samba-tool drs showrepl > "$TMPFILE" ||
   ! grep -q 'Last attempt .* successful' "$TMPFILE" ||
     grep -q 'Last attempt .* failed' "$TMPFILE"; then
    echo "Restarting Samba AD DC at $(date)"
    service samba-ad-dc restart
fi

rm -f "$TMPFILE"

-----


Best regards.

George


More information about the samba mailing list