<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Thanks to everybody who has contributed to this. Let me summarize things, if it is only for my own benefit - I learn more quickly when I try to explain that I am trying to learn something to others.<div><br></div><div>I instrumented my script in order to find out exactly how many times it is invoked when creating my resource, and exactly what functions in the script are invoked. Just as a reminder, the logs I am about to describe are created directly as a result from executing the following command:</div><div><br></div><div># pcs resource create ClusterMyApp ocf:myapp:myapp-script op monitor interval=30s<br></div><div><br></div><div>myapp-script is always the same, and the starting conditions for the app that it is meant to launch are always exactly the same. In all cases before issuing the command above I made sure to delete the resource, if already there. </div><div><br></div><div>What follows is a log of the way in which myapp-script was invoked as a result of executing the command above. It consists of a series of blocks, like the following:</div><div><br></div><div><div> <span style="white-space:pre">   </span>monitor:</div><div><br></div><div>    Status: NOT_RUNNING</div><div>    Exit: NOT_RUNNING</div></div><div><br></div><div>This block is an invocation of myapp-script with argument 'monitor'. The 'Status' line means myapp_monitor was invoked, and it returned OCF_NOT_RUNNING.  The 'Exit' line means that myapp-script exited with OCF_NOT_RUNNING.  In a block with more than two lines, the line immediately preceding the 'Exit' line represents the function in the script that was invoked as a consequence of the argument passed down to the script. The other lines are nested function invocations, as a consequence of that.</div><div><br></div><div>A typical log obtained in node one would be the following:</div><div><br></div><div><div><span style="white-space:pre">  </span>monitor:</div><div><br></div><div>    Status: NOT_RUNNING</div><div>    Exit: NOT_RUNNING</div><div><br></div><div><span style="white-space:pre">      </span>start:</div><div><br></div><div>    Validate: SUCCESS</div><div>    Status: NOT_RUNNING</div><div>    Start: SUCCESS</div><div>    Exit: SUCCESS</div><div><br></div><div><span style="white-space:pre">   </span>monitor:</div><div><br></div><div>    Status: NOT_RUNNING</div><div>    Exit: NOT_RUNNING</div><div><br></div><div><span style="white-space:pre">      </span>stop:</div><div><br></div><div>    Validate: SUCCESS</div><div>    Status: SUCCESS</div><div>    Stop: SUCCESS</div><div>    Exit: SUCCESS</div><div><br></div><div><span style="white-space:pre"> </span>start:</div><div><br></div><div>    Validate: SUCCESS</div><div>    Status: NOT_RUNNING</div><div>    Start: SUCCESS</div><div>    Exit: SUCCESS</div><div><br></div><div><span style="white-space:pre">   </span>monitor:</div><div><br></div><div>   Status: SUCCESS</div><div>   Exit: SUCCESS</div></div><div><br></div><div>A few observations:</div><div><br></div><div>1. The monitor/start/stop sequence above can be repeated many times, and the number of times it is repeated varies from one run to the next. Occasionally, just three calls are made: monitor, start and monitor, exiting with SUCCESS.</div><div><br></div><div>2. It would seem that what PaceMaker is doing is the following:</div><div>   a. Check out whether the app is running.</div><div>   b. If it is not, launch it.</div><div>   c. Check out again</div><div>   d. If running, exit.</div><div>   e. Otherwise, stop it.</div><div>    f. Launch it.</div><div>   g. Go to a.</div><div><br></div><div>3. In node two, the log obtained as a consequence of creating the resource always seems to be</div><div><br></div><div>        monitor:</div><div><br></div><div>   Status: NOT_RUNNING</div><div>   Exit: NOT_RUNNING</div><div><br></div><div>which  makes sense to me.</div><div><br></div><div>4. If the above is correct, and if I am getting the picture correctly, it would seem that the problem is that my monitoring function does not detect immediately that my app is up and running. That's clearly my problem. However, is there any way to get PaceMaker to introduce a delay between steps b and c in section 2 above?</div><div><br></div><div>5. Following up on 4: if my script sleeps for a few seconds immediately after launching my app (it's a daemon) in myapp_start then everything works fine. Indeed, the call sequence in node one now becomes:</div><div><div><br></div><div>         monitor:</div><div><br></div><div>    Status: NOT_RUNNING</div><div>    Exit: NOT_RUNNING</div><div><br></div><div>          start:</div><div><br></div><div>    Validate: SUCCESS</div><div>    Status: NOT_RUNNING</div><div>    Start: SUCCESS</div><div>    Exit: SUCCESS</div><div><br></div><div>          monitor:</div><div><br></div><div>    Status: SUCCESS</div><div>    Exit: SUCCESS</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></div></div>