I want to use ssh-run to restart my Spring project in remote server. My project is built into a .jar file and is uploaded to the server.
- pipe: atlassian/ssh-run:0.2.6
variables:
SSH_USER: $USER
SERVER: $SERVER
COMMAND: 'pkill -9 -f app.jar | nohup /(dir)/app.jar &'
I tried the command above. The pipeline result says it succeded, but the process was not working.
I searched and found someone saying that when 'nohup ... &' command doesn't work, put 'sleep 1' command next to it. So I tried blow.
- pipe: atlassian/ssh-run:0.2.6
variables:
SSH_USER: $USER
SERVER: $SERVER
COMMAND: 'pkill -9 -f app.jar | nohup /(dir)/app.jar & sleep 1'
Now the service works. It successfully restarts the service every time I push the code.
But the problem is that the pipeline result says it 'failed'. Also, it sends me email every time which is very annoying. (I can't even disable it in setting)
So I want to know how people use pipeline ssh-run command to execute a file to run service in background.
Thank you.