From d76a108b97bba46515ea460a688f9a8538e0b769 Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Mon, 7 Mar 2011 20:12:09 +0000 Subject: [PATCH] =?UTF-8?q?Lock=20am=C3=A9lior=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/update_domains.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/update_domains.sh b/src/update_domains.sh index 8623e317..001facc5 100644 --- a/src/update_domains.sh +++ b/src/update_domains.sh @@ -29,7 +29,12 @@ if [ `id -u` -ne 0 ]; then elif [ -z "$DEFAULT_MX" -o -z "$PUBLIC_IP" ]; then log_error "Bad configuration. Please use: dpkg-reconfigure alternc" elif [ -f "$LOCK_FILE" ]; then - log_error "last cron unfinished or stale lock file ($LOCK_FILE)." + process=$(ps f -p `cat "$LOCK_FILE"|tail -1`|tail -1|awk '{print $NF;}') + if [ "$(basename $process)" = "$(basename "$0")" ] ; then + log_error "last cron unfinished or stale lock file ($LOCK_FILE)." + else + rm "$LOCK_FILE" + fi fi # backward compatibility: single-server setup @@ -38,7 +43,8 @@ if [ -z "$ALTERNC_SLAVES" ] ; then fi # We lock the application -touch "$LOCK_FILE" +echo $$ > "$LOCK_FILE" +read # 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 @@ -105,7 +111,7 @@ for dom in $( mysql_query "select domaine from domaines where dns_action = 'DELE done -if [ $RELOAD_WEB ] ; then +if [ ! -z $RELOAD_WEB ] ; then RELOAD_ZONES="$RELOAD_ZONES apache" # Concat the apaches files