Bash script to start java spring boot application from SSH
1
vote
3
answers
1866
views
I have a simple bash script file, which is triggered from pipeline job ( via SSH ).
The **deploy.sh** contains more or less something like this:
cd /apps && java -jar "-Dspring.profiles.active=prod " "-Dserver.port=$PORT " \
"/apps/$DEPLOYING_VERSION" &
And some other logic which is not so important.
The pipeline via SSH executes:
bash /deploy.sh ${APPLICATION_NAME}
How to start **deploy.sh** in order the java -jar to be executed and separated from the **deploy.sh** in order my pipeline (job) to finish and in the same time, the java app to continue working on the machine?
I tried with
cd /apps && nohup java -jar "-Dspring.profiles.active=prod " "-Dserver.port=$PORT " \
"/apps/$DEPLOYING_VERSION" &
But the job stuck...
It will be cool to track and the exit from the java -jar, but it is not so important right now :)
Asked by ROZZ
(109 rep)
Nov 20, 2022, 04:33 PM
Last activity: Jul 12, 2024, 06:49 AM
Last activity: Jul 12, 2024, 06:49 AM