I have a jar file that runs continuously and acts on various events. I need to create multiple instances of this jar, passing parameters to it on start up, and have it continue to run between shell sessions, reboots, etc. I'm planning to write an init.d script that has the command for each instance I need, passing in the appropriate parameters for each, and having it execute on boot. Does this sound like the correct approach?

It's possible that one of these instances can get stuck or crash, and I'll need to go in and restart it manually. I'm also wondering if there's a way that I can name each process that gets created, so when I look at top I can determine which process is which?


init script sounds fine. You should parameterise it via some config in /etc/, though.

You can get the PID of each of the java processes after starting them and then permanetly check if all are still running, and if not, restart. It is better to use an application level monitoring (depending on what the processes do) and act based on that. Just because the process is still there it doesn't mean it is doing what it should.

  • Good point. I could create a simple web page displaying the status of each. – Chris Stewart Apr 17 '12 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.