0
votes

I'm using Azure DevOps (formerly known VSTS) to run a script in a Linux Machine (specifically CentOS machine).

I have an inline script task that runs the process on background, but after the deployment group phase has ended. The process that was created is also terminated.

Below is the sample script I've written

Using screen:

screen -dm ping localhost

Result:

  • Release is successful
  • Process id can't be found in target server
  • Shows that the screen is dead

Using nohup + redirection + ampersand

nohup ping localhost 2>&1 &

Result:

  • The task didn't finished, it's stuck.

Is this the default behavior of VSTS Deployment Agents?

1
screen and nohup are both meant to keep a process running on a machine which keeps running after the user has logged out again or lost connection. They cannot survive a shutdown of the machine. Are you sure in your case that the machine (vm probably) really keeps running after your disconnect?Alfe
@Alfe, yes. I ran it manually in via PuTTY, closed the terminal. Connected to VM again using different username, I can still see the PID.Freddie Fabregas

1 Answers

2
votes

Yes, it is the default behavior. VSTS will close all the processes that launched during the execution when the build/deployment is finished.