Merged changesets 3086, 3090, 3104 from trunk to branch stable-1.0

This commit is contained in:
Alexis Lahouze 2011-10-18 18:38:24 +00:00
parent 47b7b4ec82
commit 751ed5bf4d
4 changed files with 36 additions and 8 deletions

View File

@ -17,3 +17,8 @@
# Once a week at 7am, optimise the AlternC database # Once a week at 7am, optimise the AlternC database
0 1 * * 7 root /usr/lib/alternc/alternc-dboptimize 0 1 * * 7 root /usr/lib/alternc/alternc-dboptimize
# We change the session directory... debian's patch modified :
# Look for and purge old sessions every 30 minutes
09,39 * * * * root [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/alternc/sessions/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -delete

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# $Id: update_domaines.sh,v 1.31 2005/08/29 19:21:31 anarcat Exp $ # $Id: update_domaines.sh,v 1.31 2005/08/29 19:21:31 anarcat Exp $
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
@ -53,20 +53,30 @@ apache_reload() {
fi 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="$*" RELOAD_ZONES="$*"
echo $RELOAD_ZONES
if [ ! -z "$RELOAD_ZONES" ]; then if [ ! -z "$RELOAD_ZONES" ]; then
for zone in $RELOAD_ZONES; do for zone in $RELOAD_ZONES; do
case $zone in case $zone in
"all") "all")
$sudo rndc reload || echo "Cannot reload bind" $sudo rndc reload || echo "Cannot reload bind"
apache_reload # keep for compatibility apache_reload # keep for compatibility
;; ;;
"dns_daemon")
dns_restart
;;
"apache") "apache")
apache_reload apache_reload
;; ;;
*) *)
$sudo rndc reload "$zone" || echo "Cannot reload bind for zone $zone" $sudo rndc reload "$zone" || echo "Cannot reload bind for zone $zone"
;; ;;
esac esac
done done

View File

@ -49,13 +49,17 @@ dns_named_conf() {
return 1 return 1
fi fi
grep -q "$domain" "$NAMED_CONF" # Add the entry
grep -q "\"$domain\"" "$NAMED_CONF"
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
local tempo=$(cat "$NAMED_TEMPLATE") local tempo=$(cat "$NAMED_TEMPLATE")
tempo=${tempo/@@DOMAINE@@/$domain} tempo=${tempo/@@DOMAINE@@/$domain}
tempo=${tempo/@@ZONE_FILE@@/$(dns_zone_file $domain)} tempo=${tempo/@@ZONE_FILE@@/$(dns_zone_file $domain)}
echo $tempo >> "$NAMED_CONF" echo $tempo >> "$NAMED_CONF"
fi fi
# Ask for restart of dns server
touch "$DNS_DO_RESTART"
} }
dns_delete() { dns_delete() {
@ -69,6 +73,9 @@ dns_delete() {
# Remove from the named conf # Remove from the named conf
local file=$(cat "$NAMED_CONF") local file=$(cat "$NAMED_CONF")
echo -e "$file" |grep -v "\"$domain\"" > "$NAMED_CONF" echo -e "$file" |grep -v "\"$domain\"" > "$NAMED_CONF"
# Ask for restart of dns server
touch "$DNS_DO_RESTART"
} }
# DNS regenerate # DNS regenerate

View File

@ -21,6 +21,7 @@ OLDIFS="$IFS"
NEWIFS=" " NEWIFS=" "
RELOAD_ZONES="$(mktemp /tmp/alternc_reload_zones.XXXX)" RELOAD_ZONES="$(mktemp /tmp/alternc_reload_zones.XXXX)"
RELOAD_WEB="$(mktemp /tmp/alternc_reload_web.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 B="µµ§§" # Strange letters to make split in query
echo "" > "$RELOAD_ZONES" echo "" > "$RELOAD_ZONES"
@ -134,16 +135,21 @@ if [ ! -z "$(cat "$RELOAD_WEB")" ] ; then
fi 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 # we assume we run apache and bind on the master
tempo=$(cat "$RELOAD_ZONES"|tr '\n' ' ') /usr/bin/alternc_reload $lst_zones || true
/usr/bin/alternc_reload $tempo || true
for slave in $ALTERNC_SLAVES; do for slave in $ALTERNC_SLAVES; do
if [ "$slave" != "localhost" ]; then if [ "$slave" != "localhost" ]; then
ssh alternc@$slave alternc_reload $tempo || true ssh alternc@$slave alternc_reload $lst_zones || true
fi fi
done done
rm -f "$LOCK_FILE" "$RELOAD_ZONES" "$RELOAD_WEB" rm -f "$LOCK_FILE" "$RELOAD_ZONES" "$RELOAD_WEB" "$DNS_DO_RESTART"
exit 0 exit 0