Package: lcgdm / 1.10.0-2

lcgdm-condrestart.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
diff -ur lcgdm-1.8.6.orig/rfio/rfiod.scripts lcgdm-1.8.6/rfio/rfiod.scripts
--- lcgdm-1.8.6.orig/rfio/rfiod.scripts	2012-12-14 14:38:49.000000000 +0100
+++ lcgdm-1.8.6/rfio/rfiod.scripts	2013-04-20 18:57:30.729337009 +0200
@@ -13,10 +13,6 @@
 PREFIX=/opt/lcg
 GRIDMAPDIR=/etc/grid-security/gridmapdir
 export GRIDMAPDIR
-if [ -d /opt/lcg/lib ] ; then
-    LD_LIBRARY_PATH=/opt/lcg/lib:/opt/glite/lib:/opt/globus/lib
-    export LD_LIBRARY_PATH
-fi
 CSEC_MECH=ID
 export CSEC_MECH
 CSEC_NOTHREAD=1
@@ -32,7 +28,7 @@
     . /etc/rc.d/init.d/functions
     DAEMON=daemon
     FAILURE=failure
-    ECHO_FAILURE=failure
+    ECHO_FAILURE=echo_failure
     SUCCESS=success
     ECHO_SUCCESS=echo_success
     ECHO_END=echo
@@ -86,18 +82,12 @@
 
 case "$1" in
   start)
-    echo $ECHOOPT "Starting $prog: "
     if [ -f ${NOMORERFIO} ]; then
         echo $ECHOOPT "${NOMORERFIO} exists: "
         [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "${NOMORERFIO} exists: "
         RETVAL=0
     else
-        if [ $sysname = "Linux" -a `whoami` = "root" ]; then
-            netstat -ap | egrep '\*:5001|\*:rfio' | grep LISTEN | grep rfiod > /dev/null
-        else
-            netstat -a  | egrep '\*[:.]5001|\*[:.]rfio' | egrep 'LISTEN *$' > /dev/null
-        fi
-        # ps -eo ppid,$format4comm | egrep '^[ \t]+1 rfiod' > /dev/null
+        netstat -an | egrep '[:.]5001' | egrep 'LISTEN *$' > /dev/null
         if [ $? -eq 0 ]; then
             echo $ECHOOPT "rfiod already started: "
             [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "rfiod already started: "
@@ -121,6 +111,7 @@
                 fi
             fi
             if [ $RETVAL -eq 0 ]; then
+                echo $ECHOOPT "Starting $prog: "
                 cd /
                 mkdir -p `dirname $RFIOLOGFILE`
                 chown dpmmgr:dpmmgr `dirname $RFIOLOGFILE`
@@ -134,10 +125,10 @@
                         rm -f $PIDFILE
                         echo $pid > $PIDFILE
                     fi
+                    [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "Starting $prog: "
                     RETVAL=0
                 else
-                    echo $ECHOOPT "rfiod not started: "
-                    [ -n "$FAILURE" ] && $FAILURE "rfiod not started: "
+                    [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "Starting $prog: "
                     RETVAL=1
                 fi
             fi
@@ -147,63 +138,46 @@
     ;;
   stop)
     if [ -f $PIDFILE ]; then
-        [ $SILENTSTOP -eq 0 ] && echo $ECHOOPT "Stopping $prog: "
+        echo $ECHOOPT "Stopping $prog: "
         #
         ## We just attempt to kill the main daemon
         ## Remaining child are allowed to continue transfer up to
         ## the end
         #
-        if [ $SILENTSTOP -eq 0 ]; then
-            kill -9 `cat $PIDFILE`
-        else
-            kill -9 `cat $PIDFILE` > /dev/null 2>&1
-        fi
+        kill -9 `cat $PIDFILE` > /dev/null 2>&1
         RETVAL=$?
         if [ $RETVAL -eq 0 ]; then
             rm -f $PIDFILE
+            [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "Stopping $prog: "
+        else
+            [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "Stopping $prog: "
         fi
     else
         # rfio might have been started by hand
         pid=`ps -eo pid,ppid,$format4comm | grep " 1 rfiod$" | awk '{print $1}'`
         if [ -n "$pid" ]; then
-            [ $SILENTSTOP -eq 0 ] && echo $ECHOOPT "Stopping $prog: "
+            echo $ECHOOPT "Stopping $prog: "
             #
             ## We just attempt to kill the main daemon
             ## Remaining child are allowed to continue transfer up to
             ## the end
             #
-            if [ $SILENTSTOP -eq 0 ]; then
-                kill -9 $pid
+            kill -9 $pid > /dev/null 2>&1
+            RETVAL=$?
+            if [ $RETVAL -eq 0 ]; then
+                [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "Stopping $prog: "
             else
-                kill -9 $pid > /dev/null 2>&1
+                [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "Stopping $prog: "
             fi
-            RETVAL=$?
-        else
-            [ $SILENTSTOP -eq 0 ] && echo $ECHOOPT "rfiod already stopped: "
-            [ $SILENTSTOP -eq 0 -a -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "rfiod already stopped: "
-            RETVAL=0
-        fi
-    fi
-    if [ $SILENTSTOP -eq 0 -a $sysname = "Linux" ]; then
-        if [ $RETVAL -eq 0 ]; then
-            $ECHO_SUCCESS
         else
-            $ECHO_FAILURE
+            echo $ECHOOPT "rfiod already stopped: "
+            [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "rfiod already stopped: "
+            [ $SILENTSTOP -eq 0 ] && RETVAL=0 || RETVAL=1
         fi
     fi
 
     [ -d $SUBSYSDIR ] && rm -f $SUBSYS
-    [ $SILENTSTOP -eq 0 -a -n "$ECHO_END" ] && $ECHO_END
-    #
-    ## Basically: if SILENTSTOP is not 0 when we never print something
-    ## But if the stop is successful... One might want to see stop: OK
-    ## anyway ?
-    #
-    if [ $SILENTSTOP -ne 0 -a $RETVAL -eq 0 ]; then
-        echo $ECHOOPT "Stopping $prog: "
-        [ $sysname = "Linux" ] && $ECHO_SUCCESS
-        [ -n "$ECHO_END" ] && $ECHO_END
-    fi
+    $ECHO_END
     ;;
   restart | force-reload)
     $0 stop
@@ -211,15 +185,7 @@
         $0 start
         RETVAL=$?
     else
-        #
-        ## It is legal to return zero it if was
-        ## a conditional restart
-        #
-        if [ $SILENTSTOP -eq 0 ]; then
-            RETVAL=1
-        else
-            RETVAL=0
-        fi
+        RETVAL=0
     fi
     ;;
   condrestart | try-restart)