On Thu, Mar 25, 2010 at 9:32 AM, Andreas Mock <andreas.m...@web.de> wrote:
> -----Ursprüngliche Nachricht-----
> Von: Andrew Beekhof <and...@beekhof.net>
> Gesendet: 25.03.2010 09:15:11
> An: Andreas Mock <andreas.m...@web.de>
> Betreff: Re: [Openais] Unusual exit code with /etc/init.d/corosync stop
>
>>On Tue, Mar 23, 2010 at 12:42 AM, Andreas Mock [ wrote:
>>> Hi all,
>>>
>>> I'm using corosync 1.2.0 from the packages of clusterlabs.org on openSuSE 
>>> 11.2.
>>> A correct /etc/init.d/corosync stop issues a return code of 1
>>
>>The rc code isn't coming from corosync at all.
>>Its coming from the last command in stop(), which is "echo".
>
> Where in my original post did I say that the return code comes from  corosync 
> (binary)??
>
> Please read the mail completely. In the first sentence I just described the
> version and platform I'm using and that the script /etc/init.d/corosync 
> issues a
> return code of 1 when stopping worked correctly.
>
> Some lines further - you can see them in your quoted post - I'll explain - 
> probably in bad English -
> what the reason for this return code is, as I investigated this problem by 
> debugging
> the script /etc/init.d/corosync.
>
> Read the rest of my mail carefully and you get the reason for that behaviour.
> a) The very last line is: exit $rtrn
> b) Where is the global variable $rtrn initialized and set??
> c) It gets set in shell function status!!
> d) When you do a stop and the stop works status is called the last time in 
> the while
> loop setting $rtrn to 1.
> e) This variable is never changed afterwards.
> f) It is returned by the last statement, look at a)

Do try to calm down a little.
I made a mistake, it happens when one tries responding to 40-50
conversations a day.

Patching after stop is wrong though, the root cause is status() not
using a local variable.

--- ./etc/init.d/corosync.old   2010-03-25 10:21:19.673779309 +0100
+++ ./etc/init.d/corosync       2010-03-25 10:23:47.318779319 +0100
@@ -40,13 +40,13 @@ failure()
 status()
 {
        pid=$(pidof $1 2>/dev/null)
-       rtrn=$?
-       if [ $rtrn -ne 0 ]; then
+       rc=$?
+       if [ $rc -ne 0 ]; then
                echo "$1 is stopped"
        else
                echo "$1 (pid $pid) is running..."
        fi
-       return $rtrn
+       return $rc
 }

_______________________________________________
Pacemaker mailing list
Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Reply via email to