Linux cluster service- trouble running script
I'm having a bit of trouble setting up a linux cluster service and am hoping you can point me in the right direction. I'm a software developer and don't have much background with linux. So here's the details:
I have two laptops running Scientific Linux (basically redhat from my understanding), and set them up in a 2 node failover cluster. Got that working using conga- luci, ricci, and rgmanager.
My goal is to have the cluster manage and monitor the failover of a process- specifically a java program. I created a script to start the program and that runs fine on its own. The program is meant to run continuously, so the script doesn't ever exit. Using the cluster, I created a service and added the script as a resource. I'm having trouble running the service correctly though. I have tried two approaches with the service with varying results:
1. Simply ran the service with the script running in foreground. Script seems to start up the process, but the service seems to be stuck. If I refresh the page, it shows the service is running, but is then unable to stop the service. It is also unable to relocate the service.
2. Ran the service with the script running in the background. The service starts up fine, but it reruns the script every 10-20 seconds or so. So I end up with 5/6 processes running within the first minute.
So my question is can the cluster be used to monitor the process of my application? ideally if the process stops the cluster would try to restart or relocate it. if the cluster can be used, are there any ideas what i'm setting up wrong?
Also, is it the default behavior of a cluster service to rerun scripts that finish executing? I've been through the documentation but can't find anything useful on how a service with a script resource should be used- or any of the options available when configuring these.
Thanks for any help you can give!