I am experimenting with running Spring Boot apps on a remote CentOS 7 web server which has been successfully serving up apps on Apache and a stand-alone tomcat instance since day one. However, when I ssh
to the remote server and launch a Spring Boot app (which is in a jar that contains its own embedded tomcat instance), the Spring Boot web service jar
runs successfully while my ssh
connection is live, but then terminates after my ssh
session ends. What specific steps do I have to take to get the jar
containing the Spring Boot web service to continue running after my ssh
session is terminated?
Here is what I typed to start the app using an ssh session from my devbox many hundreds of miles away:
[ ~]$ cd /path/to/webservice
[ webservice]$ kill $(lsof -t -i:9000)
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
[ webservice]$ java -jar mywebservice.jar
Since apache forwards requests for the service internally to port 9000
, the service is then exposed to the outside world via an apache url somedomain.com/someurlpattern
until I terminate the ssh
session.