I'm new when it comes to deploying Java and Jetty applications. I use the default settings to configure my pier and run java -jar start.jarin a terminal window. The server works as expected, but when I close the terminal, it stops. This is normal? I used to use XAMPP and you can close the terminal without any problems. How can I solve this problem, everyone should from time to time close the personal computer.
java -jar start.jar
I am using mac btw.
It looks like you're using ssh or something like that to run Jetty on a remote Linux / Unix server.
, nohup java -jar start.jar & - nohup, "" Unix (ref), , & , exit , .
nohup java -jar start.jar &
nohup
&
exit
Jetty, GNU.
, screen, . , PID jps -l, kill $PID.
screen
jps -l
kill $PID
"nohup java -jar start.jar &"
)
... linux windows. , .
:
1) java style
java -DSTOP.PORT = 8077 -DSTOP.KEY = secret_key_only_admin_know -jar start.jar
java -DSTOP.PORT = 8077 -DSTOP.KEY = secret_key_only_admin_know -jar start.jar -stop
P.S. - :)
2) linux
PID
linux ( Linux).
cd , , :
cd /home/spydon/jetty/
jetty.sh, /etc/init.d/
sudo cp ./bin/jetty.sh /etc/init.d/jetty
, vim nano
sudo vim /etc/init.d/jetty
( (#)) , -
#chkconfig: 3 99 99 #description: Jetty 9 webserver #processname: jetty
, , :
#!/usr/bin/env bash # # Startup script for jetty under *nix systems (it works under NT/cygwin too). JETTY_HOME=/home/spydon/jetty # To get the service to restart correctly on reboot, uncomment below (3 lines): # ======================== chkconfig: 3 99 99 description: Jetty 9 webserver processname: jetty # ========================
( , , jetty_home. , , .)
sudo /etc/init.d/jetty start
, ,
sudo ln -s /etc/init.d/jetty /etc/rc1.d/K99jetty sudo ln -s /etc/init.d/jetty /etc/rc2.d/S99jetty
, debian.