Fixed BDII status reporting (ggus #62737).
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 11 Nov 2010 16:54:20 +0000 (16:54 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Thu, 11 Nov 2010 16:54:20 +0000 (16:54 +0000)
The problem was the startup script doing the check is called from different
user and 'kill -0' has not the permissions.

org.glite.lb.harvester/config/startup
org.glite.lb.logger/config/startup
org.glite.lb.server/config/startup

index abe657e..2169d4f 100755 (executable)
@@ -63,7 +63,7 @@ start_daemon()
        local cmd="$3"
 
        if [ -f "$pidfile" ]; then
-               if kill -0 `cat $pidfile`; then
+               if ps p `cat $pidfile` >/dev/null 2>&1; then
                        return 0
                fi
                echo -n "Warning: stalled $pidfile for $name"
@@ -83,7 +83,7 @@ stop_daemon()
                echo -n Stopping $name \($pid\) ...
                kill $pid
                try=0
-               while kill -0 $pid >/dev/null 2>&1; do 
+               while ps p $pid >/dev/null 2>&1; do 
                        sleep 1;
                        try=`expr $try + 1`
                        if [ $try = 20 ]; then
@@ -108,7 +108,7 @@ status_daemon()
 
        if [ -f "$pidfile" ]; then
                pid=`cat "$pidfile"`
-               if kill -0 $pid >/dev/null 2>&1; then
+               if ps p $pid >/dev/null 2>&1; then
                        echo "$name running as $pid"
                else
                        echo "$name not running (stalled pidfile)"
index 4bc7b50..5c3139d 100755 (executable)
@@ -40,7 +40,7 @@ start_daemon()
        local cmd="$3"
 
        if [ -f "$pidfile" ]; then
-               if kill -0 `cat $pidfile`; then
+               if ps p `cat $pidfile` >/dev/null 2>&1; then
                        return 0
                fi
                echo -n "Warning: stalled $pidfile for $name"
@@ -57,7 +57,7 @@ status_daemon()
 
        if [ -f "$pidfile" ]; then
                pid=`cat "$pidfile"`
-               if kill -0 $pid >/dev/null 2>&1; then
+               if ps p $pid >/dev/null 2>&1; then
                        echo "$name running as $pid"
                else
                        echo "$name not running (stalled pidfile)"
index 22bc30d..a47cb8a 100755 (executable)
@@ -51,7 +51,7 @@ start_daemon()
        local cmd="$3"
 
        if [ -f "$pidfile" ]; then
-               if kill -0 `cat $pidfile`; then
+               if ps p `cat $pidfile` >/dev/null 2>&2; then
                        return 0
                fi
                echo -n "Warning: stalled $pidfile for $name"
@@ -71,7 +71,7 @@ stop_daemon()
                echo -n Stopping $name \($pid\) ...
                kill $pid
                try=0
-               while kill -0 $pid >/dev/null 2>&1; do 
+               while ps p $pid >/dev/null 2>&1; do 
                        sleep 1;
                        try=`expr $try + 1`
                        if [ $try = 20 ]; then
@@ -96,7 +96,7 @@ status_daemon()
 
        if [ -f "$pidfile" ]; then
                pid=`cat "$pidfile"`
-               if kill -0 $pid >/dev/null 2>&1; then
+               if ps p $pid >/dev/null 2>&1; then
                        echo "$name running as $pid"
                else
                        echo "$name not running (stalled pidfile)"