diff --git a/cluster/apt.apply.update.sh b/cluster/apt.apply.update.sh index aeaaaff..55b374b 100755 --- a/cluster/apt.apply.update.sh +++ b/cluster/apt.apply.update.sh @@ -138,16 +138,20 @@ is_job_running() { # {{{ local_sge_hostname="${1}" ## List SGE informations about the host - ### And get the number of used slots + ### And get the number of used slots from all queues + ### Sort the results + ### Only get the last result (greater number of used slots) local_sge_slots_used=$(qhost -h "${local_sge_hostname:=/dev/null}" -q -xml \ | grep slots_used \ - | sed 's;.*\(.*\);\1;') + | sed 's;.*\(.*\);\1;' \ + | sort --numeric-sort \ + | tail --lines=1) case "${local_sge_slots_used}" in 0 ) ## No jobs are running return_job_running="1" ;; - * ) ## Results (header + queue name) so the queue is disable + * ) ## Some jobs are running return_job_running="0" ;; esac