this really silly question probably, as no one else seems to be having this problem. In the Jetty documentation it says jar -jar start.jar
starts Jetty, and it does. But when I close my SSH console, obviously it dies.
How do I run it PROPERLY?
Start Jetty standalone from the JAR file. To start Jetty, switch on the command line to the installation directory and issue the following command. To stop Jetty press Ctrl + C . To start Jetty as Windows service you can use Apache Procrun.
Eclipse Jetty is a Java web server and Java Servlet container. While web servers are usually associated with serving documents to people, Jetty is now often used for machine to machine communications, usually within larger software frameworks.
JETTY_HOME implies the path where jetty is installed and defined as JETTY_HOME on your environment variables. Too see the varible (path of the directory); based on your OS run echo %JETTY_HOME% for Windows; or echo $JETTY_HOME for Unix on your command line / terminal.
Is this for running on a production machine that will actually serve up an application running under Jetty? I assume this is the case, since you're asking about starting it properly.
If so, you need a proper process supervision system, such as runit, daemontools, monit, upstart, systemd, or good ol' SysV init.d (as mentioned w/ a gist). Which to use 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 nicely packaged by the author himself.
Despite being recommended in other answers, and mentioned in comments, starting a long running process in screen/tmux, or via nohup is sub-optimal. You don't have any real control over the process. It won't be restarted if it dies. You have to manually find its PID and otherwise manually manage the service. You have to do more manual work to get the log output (redirection, sending to some random file, etc). You cannot reliably make it depend on other processes, or have other processes depend on it. Decent process supervision systems provide all this functionality for you by default.
If your goal is something else entirely, then please update the question to be more specific about your use case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With