Friday, 15 April 2011

linux screen - kill only if it exists (jenkins job) -



linux screen - kill only if it exists (jenkins job) -

i'm configuring complex jenkins jobs using linux screens. create new screen run:

screen -md -s jenkins_job

then goes other work , destroy existing screen run:

screen -s jenkins_job -x quit

but may happen in jenkins script fail somewhere inbetween , abort immediately. screen termination command not executed , screens kept alive. in origin of job i'd create sure screens destroyed. if utilize screen -s jenkins_job -x quit on non-existent job shell homecoming error code , jenkins script fail well.

is there way conditionally destroy screen (i.e. destroy screen if exists otherwise nothing)?

you'll want set termination code trap invocation:

trap 'screen -s jenkins_job -x quit' quit term int exit

jenkins screen kill

No comments:

Post a Comment