Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do you start a background process with pipeline ssh-run?

고현민
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 9, 2020

I want to restart my Spring Boot service, by executing the .jar file I upload with pipeline.

The code below successfully starts the service, but the pipeline doesn't end because it runs on foreground.

- pipe: atlassian/ssh-run:0.2.6
variables:
SSH_USER: $USER
SERVER: $SERVER
COMMAND: 'pkill -9 -f app.jar | .../app.jar'

 

So I tried below, using nohup command.  However, it doesn't start my service.  The pipeline says the result succeeded but the service is not being launched.

- pipe: atlassian/ssh-run:0.2.6
variables:
SSH_USER: $USER
SERVER: $SERVER
COMMAND: 'pkill -9 -f app.jar | nohup .../app.jar &'

 

Someone said when nohup command doesn't work, try putting 'sleep 1' next to it.

- pipe: atlassian/ssh-run:0.2.6
variables:
SSH_USER: $USER
SERVER: $SERVER
COMMAND: 'pkill -9 -f app.jar | nohup .../app.jar & sleep 1'

 

Now it successfully starts the service.  The problem is, the pipeline result says it 'failed', and Bitbucket sends me email about the failed pipeline every time, which is very annoying.  (And I can't disable it in settings!)

So I want to know how people use ssh-run command to run background service.

Thank you.

1 answer

0 votes
Halyna Berezovska
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 12, 2020

@고현민 now when you figured out with your command, please share the logs where pipeline fails.

It will help us to discover the root cause.

 

If you have some sensitive info in logs, you may mask any string you'd not like to show up

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events