Is it to run on a production machine that will actually serve the Jetty-powered application? I assume this is so, since you are asking about his correct .
If so, you need an appropriate process monitoring system like runit , daemontools , monit , upstart , systemd , or a good ol ' SysV init.d (as mentioned by w / gist ). It depends on your preferences, business needs, and often your underlying operating system.
I use and prefer runit . It is built on solid principles (daemontools), and for my preferred distribution (Debian and Ubuntu) it is packaged by the author himself.
Despite the fact that it is recommended in other answers and mentioned in the comments, starting a long process in screen / tmux or through nohup is not optimal. You have no real control over the process. He will not be restarted if he dies. You must manually find your PID and otherwise manually manage the service. You need to do more manual work in order to get the log output (redirection, sending to an arbitrary file, etc.). You cannot depend reliably on other processes or on other processes. Decent process control systems provide all of these features by default.
If your goal is something completely different, then please update the question to clarify your use case.
source share