I am running a java application as a daemon on a Linux machine using a custom shell script.
Since I am new to java and linux, I want to know if it is possible that the application itself resurrects itself (like restarting) and recovers from cases such as application crashes, unhandled exceptions or from memory, etc.
early
Ashish Sharma
The JVM is designed to die when there is a fatal error. The ones you described fall into this category.
, , script Python script, , , , . Unix "pgrep" , , JVM (, , ). , , JVM .
, , , , , . , , , , .
Wrappers, , Java Wrapper (, Community Edition ist GPL) ,
unix "inittab" . , . (Respawn)
, - , , ; , , , , , , / , , ( , / , , , ).
, , , (, , , , , , , , "" ).
, , , " , " ( , , - "ps -blahblah" ), java "while true" :
while true do # launch the java program here, no background # when crashing, the shell will be given hand back java -classpath blahblah... echo "program crashed, relaunching it..." done
I'm not sure if the application itself can handle such crashes. You can write a script shell in linux that can work as a cron job to control the application, checking if the java application is running on schedule, and if not, it will automatically restart it.
Source: https://habr.com/ru/post/1739156/More articles:DropDownList SelectedIndex не работает в FireFox после обновления страницы - firefox"tail" of a binary based on line location using bash? - bashDoes the gcc linker find both .so and .a in the selected library path? - gccmany1 no longer works with Parsec 3.x - haskellRaphael js draws circles in all elements with a given class - javascriptIssues with MPMoviePlayerController on iPad - objective-cjquery toggle to work in multiple instances - jqueryHow do you handle files that cannot support concurrent changes in Mercurial? - mercurialJava Reflection Utility - javaProblem with form buttons in IE - htmlAll Articles