When the script calls itself either using /sbin/runuser or su - as the RUN_AS_USER, the exit code is ignored and not passed to the outer call.
The result is that you always get back a zero status code regardless of what the script actually returns.
So if you are using a 'status' call to see if your process is running you should get back a 1 from $?, but instead you always get 0.
Here is an example of the patch:
--- testwrapper.orig 2009-09-04 11:06:28.000000000 -0500
+++ testwrapper.new 2009-09-04 11:07:11.000000000 -0500
@@ -374,6 +374,7 @@
else
su - $RUN_AS_USER -c "\"$REALPATH\" $2"
fi
+ RET=$?
# Now that we are the original user again, we may need to clean up the lock file.
if [ "X$LOCKPROP" != "X" ]
@@ -389,7 +390,7 @@
fi
fi
- exit 0
+ exit $RET
fi
}
I believe this is in a few places, but didn't go looking for them all.
Steve
Steve,
Thank you very much for your suggestion.
I will have a look on this and come back to you.
Cheers,
Christian