[Samba] restarting samba using a cron job on Debian
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:
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
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.
# Stop gap measure to restart the Samba AD DC on WERR_CONNECTION_REFUSED
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
rm -f "$TMPFILE"
More information about the samba