zzlyzq zzlyzq - 3 months ago 18
Bash Question

After jenkins job complete, the service also down

I have met a problem.

I used Jenkins to install haproxy and start the service, but after the job complete, the executor is free, and the haproxy daemon also disappear.

if I use sleep 30s after the service start, and the haproxy service will also alive at the 30s, after that, the haproxy daemon will down.

Answer

This behaviour is by design, as explained in ProcessTreeKiller. To avoid daemons spawned by the Jenkins build being terminated, add

export BUILD_ID=dontKillMe

to the beginning of your shell step.