Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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