How can we trap the abort signal of the job on hudson so that i can do some post steps in case of abort (I am running a job on hudson which has shell script running in background)?
I have experienced with Jenkins, not hudson, (Jenkins is a fork of hudson) Jenkins sends a SIGTERM on Unix through Sun's JRE java.lang.UnixProcess.destroyProcess, on Windows, this is done through TerminateProcess API.
JENKINS - Aborting a build
HUDSON - Aborting a build
So you can use "trap" in your shell script by this way
#!/bin/bash
getAbort()
{
echo "Abort detected"
# other commands here if any...
}
trap 'getAbort; exit' SIGTERM
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With