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

Georges-Etienne Legendre legege at legege.com
Thu Feb 17 21:31:26 UTC 2011


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jsw-app
Type: text/x-shellscript
Size: 15234 bytes
Desc: not available
URL: <https://lists.clusterlabs.org/pipermail/pacemaker/attachments/20110217/badbdfc9/attachment-0003.bin>


More information about the Pacemaker mailing list