moving opendkim restart to the END of update_domains, prevent multiple restart
This commit is contained in:
parent
fbce91bb39
commit
4ea198a6fb
|
@ -101,7 +101,6 @@ dns_delete() {
|
|||
|
||||
# Ask the dns server for restart
|
||||
$RNDC reconfig
|
||||
service opendkim restart
|
||||
# Hook it !
|
||||
run-parts --arg=dns_reconfig /usr/lib/alternc/reload.d
|
||||
}
|
||||
|
@ -217,5 +216,4 @@ dns_regenerate() {
|
|||
|
||||
# ask bind to reload the zone
|
||||
$RNDC reload $domain
|
||||
service opendkim restart
|
||||
}
|
||||
|
|
|
@ -23,10 +23,9 @@ OLDIFS="$IFS"
|
|||
NEWIFS=" "
|
||||
LOGFORMAT_FILE="/etc/alternc/apache_logformat.conf"
|
||||
RELOAD_WEB="$(mktemp /tmp/alternc_reload_web.XXXX)"
|
||||
RELOAD_DNS="$(mktemp /tmp/alternc_reload_dns.XXXX)"
|
||||
B="µµ§§" # Strange letters to make split in query
|
||||
|
||||
echo "" > "$RELOAD_WEB"
|
||||
|
||||
# Somes check before start operations
|
||||
if [ `id -u` -ne 0 ]; then
|
||||
log_error "must be launched as root"
|
||||
|
@ -49,6 +48,9 @@ fi
|
|||
# We lock the application
|
||||
echo $$ > "$LOCK_FILE"
|
||||
|
||||
echo "" > "$RELOAD_WEB"
|
||||
echo "" > "$RELOAD_DNS"
|
||||
|
||||
# For domains we want to delete completely, make sure all the tags are all right
|
||||
# set sub_domaines.web_action = delete where domaines.dns_action = DELETE
|
||||
mysql_query "update sub_domaines sd, domaines d set sd.web_action = 'DELETE' where sd.domaine = d.domaine and sd.compte=d.compte and d.dns_action = 'DELETE';"
|
||||
|
@ -94,6 +96,7 @@ for dom in `mysql_query "select domaine from domaines where dns_action = 'UPDATE
|
|||
do
|
||||
dns_delete $dom
|
||||
mysql_query "update domaines set dns_action = 'OK', dns_result = '$?' where domaine = '$dom'"
|
||||
echo 1 >"$RELOAD_DNS"
|
||||
done
|
||||
|
||||
# Domains we have to update the dns :
|
||||
|
@ -103,6 +106,7 @@ do
|
|||
echo "dns_regenerate : domain=/$dom/"
|
||||
dns_regenerate $dom
|
||||
mysql_query "update domaines set dns_action = 'OK', dns_result = '$?' where domaine = '$dom'"
|
||||
echo 1 >"$RELOAD_DNS"
|
||||
done
|
||||
|
||||
# Domains we want to delete completely, now we do it
|
||||
|
@ -112,6 +116,7 @@ do
|
|||
dns_delete $dom
|
||||
# Web configurations have already bean cleaned previously
|
||||
mysql_query "delete from sub_domaines where domaine='$dom'; delete from domaines where domaine='$dom';"
|
||||
echo 1 >"$RELOAD_DNS"
|
||||
done
|
||||
|
||||
if [ ! -z "$(cat "$RELOAD_WEB")" ] ; then
|
||||
|
@ -152,6 +157,12 @@ if [ ! -z "$(cat "$RELOAD_WEB")" ] ; then
|
|||
run-parts --arg=web_reload /usr/lib/alternc/reload.d
|
||||
fi
|
||||
|
||||
# If we added / edited / deleted at least one dns zone file, we go here in the end:
|
||||
if [ ! -z "$(cat "$RELOAD_DNS")" ] ; then
|
||||
service opendkim restart
|
||||
run-parts --arg=dns_reload /usr/lib/alternc/reload.d
|
||||
fi
|
||||
|
||||
## FIXME : move the slave part into the /usr/lib/alternc/reload.d directory to be an hook
|
||||
#for slave in $ALTERNC_SLAVES; do
|
||||
# if [ "$slave" != "localhost" ]; then
|
||||
|
@ -159,7 +170,7 @@ fi
|
|||
# fi
|
||||
#done
|
||||
|
||||
rm -f "$LOCK_FILE" "$RELOAD_ZONES" "$RELOAD_WEB" "$INOTIFY_UPDATE_DOMAIN"
|
||||
rm -f "$LOCK_FILE" "$RELOAD_ZONES" "$RELOAD_WEB" "$INOTIFY_UPDATE_DOMAIN" "$RELOAD_DNS"
|
||||
|
||||
exit 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue