Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.