Issue
So I've tried googling and reading a few questions on here as well as elsewhere and I can't seem to find an answer.
I'm using Jenkins and executing a shell script to scp a .jar file to a server and then sshing in, running the build, and then exiting out of the server. However, I cannot get out of that server for the life of me. This is what I'm running, minus the sensitive information:
ssh [email protected] 'killall -9 java; nohup java -jar /root/project.jar -prod &; exit'
I've tried doing && exit, exit;, but none of it will get me out of the server and jenkins just spins for ever. So the Jenkins build never actually finishes.
Any help would be sweet! I appreciate it.
Solution
So I just took off the exit and ran a ssh -f [email protected] before the command and it worked. The -f just runs the ssh command in the background so Jenkins isn't sitting around waiting.
Answered By - Kristaphonie
Answer Checked By - David Marino (JavaFixing Volunteer)