I have a JAR application that launches in a detached screen on machine startup (Ubuntu 14.04). The command is screen -d -m file.sh
This works as intended minus one caveat. When he Java process terminates, so does it's screen (as expected.)
When stopping and restarting the JVM, what is the best way to ensure it will have a dedicated screen to run in?
I've read into zombie processes and tried it by modifying my .screenrc
file. This worked as explained by the article author, but the problem here is I need to press the "resurrect" key for it to actually continue. Is there a way to either automate the resurrection or, perhaps more preferably, automatically start the new JVM in a new screen- terminating the old one. Perhaps this can be done by tweaking my file.sh
shell? Or somewhere else? Any ideas appreciated.
This Jar gets started and stopped frequently for various reasons but it should always be running (or returning to a running state) unless manually stopped by an administrator, in which case admins can just enter its screen, stop it, and start it again before detaching.
Thanks for the help.