#!/bin/bash

DEFAULT="/etc/default/eole-lsc"

if [ -f "${DEFAULT}" ];then
    . "${DEFAULT}"
fi

if [ -z "${AD_ADDRESS}" ]
then
    echo "Configuration de ${DEFAULT} incorrecte ou manquante."
    exit 1
fi

echo "Test de connection au service samba-ad-dc"
while ! tcpcheck 3 $AD_ADDRESS:636 > /dev/null
do
    echo "Le service samba-ad-dc ne répond pas"
    sleep 5
done

echo "Le service samba-ad-dc est actif"

exit 0
