The little things give you away... A collection of various small helper stuff
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

26 lignes
539 B

  1. #!/bin/bash
  2. if [[ $# -ne 1 || "$1" == '-h' || "$1" == '--help' ]]
  3. then
  4. echo 'Usage: ia-wait-item-tasks IDENTIFIER'
  5. echo 'Waits until the Internet Archive item IDENTIFIER has no outstanding tasks.'
  6. echo 'Exits non-zero if there are errored tasks'
  7. exit 1
  8. fi
  9. set -e
  10. while :
  11. do
  12. out="$(ia tasks "$1")"
  13. out="$(python3 -c 'import json, sys; {print(o["status"]) for o in map(json.loads, sys.stdin) if "status" in o}' <<<"${out}")"
  14. if [[ -z "${out}" ]]
  15. then
  16. break
  17. fi
  18. if grep -Fxq 'error' <<<"${out}"
  19. then
  20. exit 1
  21. fi
  22. sleep 60
  23. done