diff --git a/cluster/disable.host.queue.sh b/cluster/disable.host.queue.sh index 06a7298..73cca1e 100755 --- a/cluster/disable.host.queue.sh +++ b/cluster/disable.host.queue.sh @@ -66,10 +66,10 @@ is_queue_enable() { # {{{ local_sge_hostname="${1}" local_sge_queue_name="${2}" ## List all queues with 'disable' state and filter to the expected queue name - ### Then count the number of lines between "queuename" (from header) and the expected queue - ### To avoid to count pending jobs for this queue - local_sge_queue_test=$(qstat -f -qs d -q "${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}" \ - | awk 'BEGIN {count = 0} /queuename/,/main.q/ {count++} END { print count }') + ## with a fake_user to avoid pending jobs for this queue + ### And count returned lines + local_sge_queue_test=$(qstat -f -qs d -q "${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}" -u fake_user \ + | wc -l) case "${local_sge_queue_test}" in 0 ) ## No result so the queue is enable @@ -100,10 +100,10 @@ is_queue_disable() { # {{{ local_sge_hostname="${1}" local_sge_queue_name="${2}" ## List all queues with 'disable' state and filter to the expected queue name - ### Then count the number of lines between "queuename" (from header) and the expected queue - ### To avoid to count pending jobs for this queue - local_sge_queue_test=$(qstat -f -qs d -q "${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}" \ - | awk 'BEGIN {count = 0} /queuename/,/main.q/ {count++} END { print count }') + ## with a fake_user to avoid pending jobs for this queue + ### And count returned lines + local_sge_queue_test=$(qstat -f -qs d -q "${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}" -u fake_user \ + | wc -l) case "${local_sge_queue_test}" in 0 ) ## No result so the queue is enable