Outils pour utilisateurs

Outils du site


tech:dns_script_check_bind9

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
tech:dns_script_check_bind9 [2025/11/11 19:00] Jean-Baptistetech:dns_script_check_bind9 [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 +{{tag>Brouillon Bind DNS Script Bash}}
 +
 +# DNS script check bind9
 +
 +`check-bind.sh`
 +~~~bash
 +#! /bin/bash
 +
 +declare -i RET
 +RET=0
 +
 +rndc reload
 +systemctl restart named.service
 +systemctl status named.service
 +RET=$((RET + $?))
 +
 +IP_DNS=$(dig @127.0.0.1 plop.acme.local +short)
 +if [ -z "$IP_DNS" ]
 +then
 +        RET=$((RET + 1 ))
 +fi
 +
 +FQDN_DNS=$(dig @127.0.0.1 -x "$IP_DNS" +short)
 +if [ -z "$FQDN_DNS" ]
 +then
 +        RET=$((RET + 1 ))
 +fi
 +
 +
 +named-checkconf
 +RET=$((RET + $?))
 +
 +for ZONE in $(awk '/^zone/ { gsub("\"", "") ; print $2 }'  /etc/named.conf)
 +do
 +        named-checkzone "$ZONE" "/etc/named/db.${ZONE}"
 +        RET=$((RET + $?))
 +        dig -t AXFR @127.0.0.1 "$ZONE" |grep -v "^;;"
 +        RET=$((RET + $?))
 +        rndc freeze acme.local
 +        rndc reload acme.local
 +        RET=$((RET + $?))
 +        rndc thaw acme.local
 +done
 +
 +rndc status
 +RET=$((RET + $?))
 +
 +
 +echo
 +if [ $RET == 0 ]
 +then
 +        echo "*** ALL IS OK ***"
 +else
 +        echo "** ERROR ***"
 +fi
 +echo
 +
 +exit $RET
 +~~~
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki