Bind oubliait de se redemarrer lors d'ajout/suppression de zones
This commit is contained in:
parent
310c364bff
commit
26ad26bd90
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
# $Id: update_domaines.sh,v 1.31 2005/08/29 19:21:31 anarcat Exp $
|
||||
# ----------------------------------------------------------------------
|
||||
|
@ -53,7 +53,14 @@ apache_reload() {
|
|||
fi
|
||||
}
|
||||
|
||||
dns_restart() {
|
||||
if [ -x /etc/init.d/bind9 ]; then
|
||||
$sudo /etc/init.d/bind9 restart || echo "Cannot restart dns daemon (bind9)"
|
||||
fi
|
||||
}
|
||||
|
||||
RELOAD_ZONES="$*"
|
||||
echo $RELOAD_ZONES
|
||||
|
||||
if [ ! -z "$RELOAD_ZONES" ]; then
|
||||
for zone in $RELOAD_ZONES; do
|
||||
|
@ -62,6 +69,9 @@ if [ ! -z "$RELOAD_ZONES" ]; then
|
|||
$sudo rndc reload || echo "Cannot reload bind"
|
||||
apache_reload # keep for compatibility
|
||||
;;
|
||||
"dns_daemon")
|
||||
dns_restart
|
||||
;;
|
||||
"apache")
|
||||
apache_reload
|
||||
;;
|
||||
|
|
|
@ -49,6 +49,7 @@ dns_named_conf() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
# Add the entry
|
||||
grep -q "\"$domain\"" "$NAMED_CONF"
|
||||
if [ $? -ne 0 ] ; then
|
||||
local tempo=$(cat "$NAMED_TEMPLATE")
|
||||
|
@ -56,6 +57,9 @@ dns_named_conf() {
|
|||
tempo=${tempo/@@ZONE_FILE@@/$(dns_zone_file $domain)}
|
||||
echo $tempo >> "$NAMED_CONF"
|
||||
fi
|
||||
|
||||
# Ask for restart of dns server
|
||||
touch "$DNS_DO_RESTART"
|
||||
}
|
||||
|
||||
dns_delete() {
|
||||
|
@ -69,6 +73,9 @@ dns_delete() {
|
|||
# Remove from the named conf
|
||||
local file=$(cat "$NAMED_CONF")
|
||||
echo -e "$file" |grep -v "\"$domain\"" > "$NAMED_CONF"
|
||||
|
||||
# Ask for restart of dns server
|
||||
touch "$DNS_DO_RESTART"
|
||||
}
|
||||
|
||||
# DNS regenerate
|
||||
|
|
|
@ -21,6 +21,7 @@ OLDIFS="$IFS"
|
|||
NEWIFS=" "
|
||||
RELOAD_ZONES="$(mktemp /tmp/alternc_reload_zones.XXXX)"
|
||||
RELOAD_WEB="$(mktemp /tmp/alternc_reload_web.XXXX)"
|
||||
DNS_DO_RESTART="/tmp/alternc.do_do_restart.$$"
|
||||
B="µµ§§" # Strange letters to make split in query
|
||||
|
||||
echo "" > "$RELOAD_ZONES"
|
||||
|
@ -134,16 +135,21 @@ if [ ! -z "$(cat "$RELOAD_WEB")" ] ; then
|
|||
|
||||
fi
|
||||
|
||||
# What do we reload ?
|
||||
lst_zones=$(cat "$RELOAD_ZONES"|tr '\n' ' ')
|
||||
if [ -e "$DNS_DO_RESTART" ] ; then
|
||||
lst_zones="dns_daemon $lst_zones"
|
||||
fi
|
||||
|
||||
# we assume we run apache and bind on the master
|
||||
tempo=$(cat "$RELOAD_ZONES"|tr '\n' ' ')
|
||||
/usr/bin/alternc_reload $tempo || true
|
||||
/usr/bin/alternc_reload $lst_zones || true
|
||||
for slave in $ALTERNC_SLAVES; do
|
||||
if [ "$slave" != "localhost" ]; then
|
||||
ssh alternc@$slave alternc_reload $tempo || true
|
||||
ssh alternc@$slave alternc_reload $lst_zones || true
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f "$LOCK_FILE" "$RELOAD_ZONES" "$RELOAD_WEB"
|
||||
rm -f "$LOCK_FILE" "$RELOAD_ZONES" "$RELOAD_WEB" "$DNS_DO_RESTART"
|
||||
|
||||
exit 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue