better handling of startup process
This commit is contained in:
parent
520a20479e
commit
df695525e9
8 changed files with 136 additions and 68 deletions
22
wait-for-idle-queue.sh
Executable file
22
wait-for-idle-queue.sh
Executable file
|
@ -0,0 +1,22 @@
|
|||
#! /usr/bin/env bash
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
USER_HOME=$HOME
|
||||
[[ -n "${SUDO_USER}" ]] && USER_HOME="$(eval "echo ~${SUDO_USER}")"
|
||||
. ${SHRC_D:-$USER_HOME/.pqb.shrc.d}/01_util.functions
|
||||
|
||||
set -e
|
||||
|
||||
count_unfinished_jobs() {
|
||||
midclt call core.get_jobs | jq -r '.[] | select( .time_finished == null )' | wc -l
|
||||
}
|
||||
|
||||
wait_for_idle_queue() {
|
||||
while [[ "$( count_unfinished_jobs )" -gt 0 ]]; do
|
||||
printf '.'
|
||||
sleep 2
|
||||
done
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
wait_for_idle_queue
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue