Issue
I am building an executable jar file using jenkins and copying into a remote server. After the copying, I need to run the jar file in the remote server. I am using SSH Plugin
for executing the remote script.
The remote script looks like this:
startServer.sh
pkill -f MyExecutable
nohup java -jar /home/administrator/app/MyExecutable.jar &
Jenkins is able to execute the script file, but it is not stopping the job after the execution. It is still continuing the process and showing the log in jenkins console. This is creating problems since these continuing jobs blocks other jobs to execute.
How can I stop the job once the script is executed.
Solution
Finally, I was able to fix the problem. I am posting it for others sake.
I used ssh -f user@server ....
this solved my problem.
ssh -f root@${server} sh /home/administrator/bin/startServer.sh
Answered By - Yadu Krishnan