Running Spring Boot application in embedded Tomcat server in Linux - linux

I am running Spring Boot application in embedded Tomcat server. I am placing the executable jar file with Tomcat server embedded in it in a path in Linux server, logging in to Linux environment using putty, navigating to the path where I have kept my jar file and running as
java -jar my-jar.jar
The problem is using this way the embedded tomcat server will stop and the jar file will stop running when putty is exited. Can you suggest a way how to execute the executable jar file so that it keeps running in the Linux environment without stopping.
One solution I found is to run the jar as a service of Linux. Is there any other way of doing this?

You can start it as background process:
java -jar my-jar.jar &
But the Linux service is the better way.

Related

How can I make a program to run as service in Linux

Thanks for looking into my question.
I am running tomcat as windows service in windows machine. how can I achieve the same on linux machines.
it should start automatically after reboot.
Thanks,
R Dama.
If you install Tomcat from a Linux distribution package, it will usually include an init script which will start it as a daemon via a start stop script. You can create a script for it manually otherwise. See https://www.linux.com/learn/managing-linux-daemons-init-scripts

What is the best way to launch Jenkins Server

What is the best way to launch jenkins server in linux ?
Is it through deploying .war file in tomcat or through jenkins installation
It really depends how much traffic and number of builds.
I launch mine with tomcat 8 and nginx as the webserver. I used this as my guide.
I launch it via cron because on a daily basis I restart the tomcat instance.
I have used both ways to launch Jenkins server but I prefer to deploy Jenkins war file inside any web container.
It helps me to manage and upgrade Jenkins very easily.

Jenkins deployment from linux server to windows server

In company i have 3 servers, 2 linux servers and 1 windows server. I build .war on Linux server and i want to deploy it on second linux and windows server, for linux i use deploy plugin and it doesn't support version of tomcat8, and also it doesn't have option deploy war on windows server.
So my idea is to deploy war to samba directory then use copy script to obtain .war file. For windows i can use samba folder and in tomcat configuration use a deploy Application from a Local Path. Is there some more gentle solution of this problem ? If there some risk from using that solution ?
Edit:
In case when I try to use mounted directory, i use docBase="//ip/directory" and path="directory" i obtain error with The main resource set specified [\ip\directory] is not valid. I'm curious is even possible to do this ?
So if someone will face the same problem that is the solution:
On Jenkins server install plugin to execute shell scripts. That allow us to run cURL command.
To deploy .war on Windows server use command with cURL, example:
curl -T /var/lib/jenkins/jobs/(Path to war ) http://user:password#ip:port/manager/text/deploy?path=/(nameOfWar)&update=true
Also add role manager-script to your Tomcat user.
For deploy on Linux servers I use plugin Deploy war/ear to a container. So it's all in Jenkins and Tomcat.

Run a program as a service on Debian/Linux

I have an older jetty server I want to turn into as a service on a Debian OS. It should start automatic each time I restart the computer.
Manually I start the server with the two following commands:
root#myserver:/# cd /opt/jdk/jetty
root#myserver:/opt/jdk/jetty# java jetty
Anyone know how to do this ?
If you want to start any program on booting you can add that entry in rc.local.
java /opt/jdk/jetty/jetty
It will start on reboot

Getting Tomcat to play well with Netbeans 6.7 on Linux

I have an external Tomcat server configured to run J2EE applications on my development (Gentoo Linux install) machine. This works great if the server is started prior to opening Netbeans and deploying the code [within the IDE]. This fails when I try to restart the server or to debug the server application. The error I get is that it is unable to find "catalina.sh" and the shutdown/start scripts for tomcat.
The Gentoo guide for this suggests that the scripts were outdated and were replaced with the init.d scripts. Does anyone have a suggestion on where I could find these scripts or how they solved this issue?
The lack of a script is due to an issue with the Gentoo Tomcat ebuild... all of the script files were in the bin directory of the src build.
Gentoo Bug Site
Solution:
1. un-tar the src
Copy all of the script files into the tomcat/bin directory
Change group ownership of the script files to tomcat
Enable execute and write group permissions to the script files

Resources