[Pacemaker] Monitoring fails with Run-As-User in init.d script

Georges-Etienne Legendre legege at legege.com
Thu Feb 17 17:55:25 EST 2011


Ok, we found it.

The JSW script is not compliant to LSB Resource Agent specification,
when used with RUN_AS_USER.

Here is the fix:
  su - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA"
  EXIT_CODE=$?
  ...
  exit $EXIT_CODE

I'll report this issue to the JSW team.

Thanks,
-- 
Georges-Etienne

On Thu, 17 Feb 2011 16:31:26 -0500, Georges-Etienne Legendre
<legege at legege.com> wrote:
> Hi,
> 
> We're using Java Service Wrapper (JSW) to bundle our Java
> application. JSW provides an init.d script which appears to be
> compliant to LSB Resource Agent specification
> (http://refspecs.linux-foundation.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html).
> 
> We configure the JSW init.d script to run our application as a
> specific user (RUN_AS_USER).
> 
> When root uses this script, everything works as expected:
>  /etc/init.d/my-java-app start
>  Starting MY JAVA APP...
>  Exit code: 0
> 
>  /etc/init.d/my-java-app status
>  MY JAVA APP is running (15017).
>  Exit code: 0
> 
>  /etc/init.d/my-java-app stop
>  Stopping MY JAVA APP...
>  Stopped MY JAVA APP.
>  Exit code: 0
> 
> Here is my Corosync/Pacemaker config:
> 
>  primitive my-java-app lsb:my-java-app \
>        op start interval="0" timeout="180s" \
>        op stop interval="0" timeout="180s" \
>        op monitor interval="15s" timeout="60s" \
>        meta failure-timeout="30s"
> 
> Corosync is able to start/stop this application. However, the
> monitoring doesn't work: when I manually kill the application,
> Corosync doesn't restart the application. But when I run the
> application as root, everything is fine.
> 
> The attached file is the JSW init.d script.
> 
> To launch the application as the specified user, the init.d script
> calls itself (su -m my_user -c "\"/etc/init.d/my-java-app" status").
> Of course, when this init.d script is initially called by root, no
> password is asked (because it's root!). When this init.d script is
> initially launched by another user, a password is asked. That should
> not be the case of corosync right? The LSB process runs as root.
> 
> Thanks for your help!
> --
> Georges-Etienne





More information about the Pacemaker mailing list