Remove stale sockets and other files too before startup, SB #77357.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 26 Jan 2011 12:52:32 +0000 (12:52 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 26 Jan 2011 12:52:32 +0000 (12:52 +0000)
org.glite.lb.harvester/config/startup
org.glite.lb.logger/config/startup
org.glite.lb.server/config/startup

index 2169d4f..f04348c 100755 (executable)
@@ -44,6 +44,8 @@ if [ -n "$GLITE_LB_HARVESTER_CONFIG" ]; then
 fi
 [ -n "$GLITE_LB_HARVESTER_DBCS" ] && conf="$conf -m $GLITE_LB_HARVESTER_DBCS"
 
+HARVESTER_NOTIFSFILE=/var/tmp/notifs.txt
+
 unset creds port log4c
 
 [ -n "$GLITE_HOST_CERT" -a -n "$GLITE_HOST_KEY" ] &&
@@ -61,13 +63,20 @@ start_daemon()
        local name="$1"
        local pidfile="$2"
        local cmd="$3"
+       local stale="$4"
 
        if [ -f "$pidfile" ]; then
                if ps p `cat $pidfile` >/dev/null 2>&1; then
                        return 0
                fi
-               echo -n "Warning: stalled $pidfile for $name"
+               echo "Warning: stale $pidfile for $name"
                rm -f "$pidfile"
+               if [ -n "$stale" ]; then
+                       for file in $stale; do
+                               echo "Warning: stale $file for $name"
+                               rm -f "$file"
+                       done
+               fi
        fi
        echo -n "Starting $name ..."
        su - $GLITE_USER -c "$log4c $cmd" && echo " done" || echo " FAILED"
@@ -111,7 +120,7 @@ status_daemon()
                if ps p $pid >/dev/null 2>&1; then
                        echo "$name running as $pid"
                else
-                       echo "$name not running (stalled pidfile)"
+                       echo "$name not running (stale pidfile)"
                        return 1
                fi
        else
@@ -143,7 +152,7 @@ start()
 
        start_daemon glite-lb-harvester "$pidfile" "$GLITE_LOCATION/bin/glite-lb-harvester \
                $creds $conf -i $pidfile -d $level $port --daemon\
-               $GLITE_LB_HARVESTER_OTHER_OPTIONS"
+               $GLITE_LB_HARVESTER_OTHER_OPTIONS" "$HARVESTER_NOTIFSFILE"
 }
 
 stop()
index 5c3139d..7a70366 100755 (executable)
@@ -30,6 +30,7 @@ GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-$GLITE_LOCATION/var}
 
 LL_PIDFILE=${LL_PIDFILE:-$GLITE_LOCATION_VAR/glite-lb-logd.pid}
 IL_PIDFILE=${IL_PIDFILE:-$GLITE_LOCATION_VAR/glite-lb-interlogd.pid}
+IL_SOCKFILE=/tmp/interlogger.sock
 
 unset creds port log4c
 
@@ -38,13 +39,20 @@ start_daemon()
        local name="$1"
        local pidfile="$2"
        local cmd="$3"
+       local stale="$4"
 
        if [ -f "$pidfile" ]; then
                if ps p `cat $pidfile` >/dev/null 2>&1; then
                        return 0
                fi
-               echo -n "Warning: stalled $pidfile for $name"
+               echo "Warning: stale $pidfile for $name"
                rm -f "$pidfile"
+               if [ -n "$stale" ]; then
+                       for file in $stale; do
+                               echo "Warning: stale $file for $name"
+                               rm -f "$file"
+                       done
+               fi
        fi
        echo -n "Starting $name ..."
        su - $GLITE_USER -c "$log4c $cmd" && echo " done" || echo " FAILED"
@@ -60,7 +68,7 @@ status_daemon()
                if ps p $pid >/dev/null 2>&1; then
                        echo "$name running as $pid"
                else
-                       echo "$name not running (stalled pidfile)"
+                       echo "$name not running (stale pidfile)"
                        return 1
                fi
        else
@@ -118,7 +126,7 @@ start()
                -i $LL_PIDFILE $creds $port $sock $fprefix"
 
        start_daemon "glite-lb-interlogd" "$IL_PIDFILE" "$GLITE_LOCATION/bin/glite-lb-interlogd \
-               -i $IL_PIDFILE $creds $sock $fprefix"
+               -i $IL_PIDFILE $creds $sock $fprefix" "$IL_SOCKFILE"
 }
 
 killwait()
@@ -150,7 +158,7 @@ stop()
        if netstat -an --inet --inet6 | grep "^tcp .* \(::\|0.0.0.0\):${GLITE_LB_LOGGER_PORT:-9002} .*LISTEN" >/dev/null 2>&1 ;then
                killall -9 glite-lb-logd
        fi
-       if netstat -an --unix | grep "^unix .* LISTEN.* ${GLITE_LB_IL_SOCK:-/tmp/interlogger.sock}$" >/dev/null 2>&1 ;then
+       if netstat -an --unix | grep "^unix .* LISTEN.* ${GLITE_LB_IL_SOCK:-$IL_SOCKFILE}$" >/dev/null 2>&1 ;then
                killall -9 glite-lb-interlogd
        fi
 }
index a47cb8a..e1afc9f 100755 (executable)
@@ -49,13 +49,20 @@ start_daemon()
        local name="$1"
        local pidfile="$2"
        local cmd="$3"
+       local stale="$4"
 
        if [ -f "$pidfile" ]; then
-               if ps p `cat $pidfile` >/dev/null 2>&2; then
+               if ps p `cat $pidfile` >/dev/null 2>&1; then
                        return 0
                fi
-               echo -n "Warning: stalled $pidfile for $name"
+               echo "Warning: stale $pidfile for $name"
                rm -f "$pidfile"
+               if [ -n "$stale" ]; then
+                       for file in $stale; do
+                               echo "Warning: stale $file for $name"
+                               rm -f "$file"
+                       done
+               fi
        fi
        echo -n "Starting $name ..."
        su - $GLITE_USER -c "$log4c $cmd" && echo " done" || echo " FAILED"
@@ -99,7 +106,7 @@ status_daemon()
                if ps p $pid >/dev/null 2>&1; then
                        echo "$name running as $pid"
                else
-                       echo "$name not running (stalled pidfile)"
+                       echo "$name not running (stale pidfile)"
                        return 1
                fi
        else
@@ -209,13 +216,13 @@ start()
                --notif-il-sock=$GLITE_LB_NOTIF_SOCK \
                --notif-il-fprefix=$GLITE_LB_NOTIF_FPREFIX \
                $super $creds -i $BK_PIDFILE $port $wport $dumpdir $purgedir $lbreg_maildir $proxy $policy\
-               $GLITE_LB_SERVER_OTHER_OPTIONS"
+               $GLITE_LB_SERVER_OTHER_OPTIONS" "/tmp/lb_proxy_serve.sock /tmp/lb_proxy_store.sock"
 
        if test -x $GLITE_LOCATION/bin/glite-lb-notif-interlogd; then
                start_daemon glite-lb-notif-interlogd "$NOTIF_IL_PIDFILE" "$GLITE_LOCATION/bin/glite-lb-notif-interlogd \
                        -f $GLITE_LB_NOTIF_FPREFIX -s $GLITE_LB_NOTIF_SOCK \
                        -i $NOTIF_IL_PIDFILE -M 10485760 \
-                       $creds $GLITE_LB_NOTIF_IL_OTHER_OPTIONS"
+                       $creds $GLITE_LB_NOTIF_IL_OTHER_OPTIONS" "$GLITE_LB_NOTIF_SOCK"
        else
                echo Warning: glite-lb-notif-interlogd not installed, LB notifications will not work
        fi
@@ -233,7 +240,7 @@ start()
                        start_daemon "glite-lb-interlog for proxy" "$PROXY_IL_PIDFILE" "$GLITE_LOCATION/bin/glite-lb-interlogd \
                                -f $GLITE_LB_PROXY_FPREFIX -s $GLITE_LB_PROXY_SOCK \
                                -i $PROXY_IL_PIDFILE \
-                               $creds $GLITE_LB_PROXY_IL_OTHER_OPTIONS"
+                               $creds $GLITE_LB_PROXY_IL_OTHER_OPTIONS" "$GLITE_LB_PROXY_SOCK"
                else
                        echo Warning: glite-lb-interlogd not installed, logging to LB proxy will not work
                fi