I'd like to have a Jenkins job which kills all processes on port 5000 (bash). The easy solution
fuser -k 5000/tcp
works fine when I execute this command in the terminal, but on Jenkins ("execute shell") marks build as failure.
I have tried also
kill $(lsof -i -t:5000)
but again, as it works on regular terminal, on Jenkins I get
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
Build step 'Execute shell' marked build as failure
Any ideas how to fix this?
I hadd the same problem. It did not work when the process was not running.
bash
just did it, but jenkins failed.You can add an
|| true
to your jenkins job to indicate jenkins to proceed with the job if the bash command fails.So its:
see also don't fail jenkins build if execute shell fails