Is there a way to determine if there is a job running in a jetstream container?

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered
Photo of Jim Daniels

Jim Daniels

  • 150 Points 100 badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of Adam Bowen

Adam Bowen, Official Rep

  • 17,884 Points 10k badge 2x thumb
Official Response
Sure. I do simple checks like that in my automation. Take a look at this shell function that I wrote that takes a reference id (all delphix objects have one) and waits for the jobs to complete.

function RUNNING_JOBS_WAIT { #This function wais for jobs to finish on the specified target
#Takes one parameter: The target reference
until [[ 1 -gt 2 ]]; do
fJOB=$(curl -X GET -k "http://${DEIP}/resources/json/delphix/job?target=${TARGETREF}&jobState=RUNNING"; \
-b ~/cookies.txt -H "Content-Type: application/json"| jq -r ".result[].reference")
if [[ -n ${fJOB} ]]; then
echo "Waiting on $fJOB to complete"
sleep 5
echo "Job's done"