16_2c_1d_1p_priv_export 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/bash
  2. printf "$PRINTFPATTERN" $0 : "2 Compilations. 1 Dossier. 1 Projet. Pad Privé. export/txt"
  3. if test "$TRAVIS" == "true";
  4. then
  5. echo "[ SKIP ]"
  6. exit 99
  7. fi
  8. URL_BASE=https%3A%2F%2Fpad.exegetes.eu.org%2Fgroup.html%2F19%2Fpad.html%2Fg.STVKtWnA83RsmVUC%24Abro2-PRIVE%2Fexport%2Ftxt
  9. URL_GARDE=https%3A%2F%2Fpad.exegetes.eu.org%2Fgroup.html%2F19%2Fpad.html%2Fg.STVKtWnA83RsmVUC%24Abro2Garde-PRIVE%2Fexport%2Ftxt
  10. DOSSIER=MonDossier$$
  11. PROJET=Abro2$$
  12. # pids conserve la liste des pids
  13. # retcode conserve le code retour de chaque pid une fois terminé
  14. handle_child() {
  15. local tmp=()
  16. for((i=0;i<${#pids[@]};++i));
  17. do
  18. if test ! -d /proc/${pids[i]};
  19. then
  20. wait ${pids[i]}
  21. retcode[${pids[i]}]=$?
  22. else
  23. tmp+=(${pids[i]})
  24. fi
  25. done
  26. pids=(${tmp[@]})
  27. }
  28. set -o monitor
  29. trap "handle_child" CHLD
  30. # Start background processes
  31. OUTPUT1=$(./cocktail -v \
  32. -d "$DOSSIER" \
  33. -p "$PROJET" \
  34. -b "$URL_BASE" \
  35. -g "$URL_GARDE" 2>&1 >/dev/null) &
  36. pids+=($!)
  37. OUTPUT="START $!"
  38. OUTPUT2=$(./cocktail -v \
  39. -d "$DOSSIER" \
  40. -p "$PROJET" \
  41. -b "$URL_BASE" \
  42. -g "$URL_GARDE" 2>&1 >/dev/null) &
  43. pids+=($!)
  44. OUTPUT=$(printf "%s\n%s" "$OUTPUT" "START $!")
  45. # Wait until all background processes are stopped
  46. while [ ${#pids[@]} -gt 0 ];
  47. do
  48. OUTPUT=$(printf "%s\n%s %s %s" "$OUTPUT" "WAITING FOR: "${pids[@]})
  49. sleep 4;
  50. done
  51. OUTPUT=$(printf "%s\n%s" "$OUTPUT" "STOPPED")
  52. # affichage des code retour et generation de la chaine de test
  53. for pid in "${!retcode[@]}"
  54. do
  55. statusstring="$statusstring $pid=${retcode[$pid]}"
  56. retcodestr="${retcodestr}${retcode[$pid]}"
  57. done
  58. echo -n "RC $statusstring "
  59. if test $retcodestr -eq "02" -o $retcodestr -eq "20";
  60. then
  61. echo "[ OK ]"
  62. echo "$OUTPUT"
  63. exit 0
  64. else
  65. echo "[FAILED]"
  66. echo "$OUTPUT"
  67. exit 1
  68. fi