Skip to content

Instantly share code, notes, and snippets.

View sfc-gh-eraigosa's full-sized avatar
๐Ÿ 
Working from home

Edward Raigosa sfc-gh-eraigosa

๐Ÿ 
Working from home
View GitHub Profile

Use this script to look for a running jenkins job on slave worker

function waitforjob() {
  jekins_slave_pid=$(ps -ef|grep slave.jar | awk '{print $2"="$8}'|grep java|awk -F'=' '{print $1}')
  if [  ! -z "${jekins_slave_pid}" ] ; then
    while pstree -pnlac ${jekins_slave_pid} |grep hudson > /dev/null 2<&1; do
       echo 'waiting for job to finish'; 
       sleep 5;
 done