14_2c_1d_2p_priv_export 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/bash
  2. printf "$PRINTFPATTERN" $0 : "2 Compilations. 1 Dossier. 2 Projets. 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. PROJET1=Abro2$$
  12. PROJET2=Abro3
  13. # pids conserve la liste des pids
  14. # retcode conserve le code retour de chaque pid une fois terminé
  15. handle_child() {
  16. local tmp=()
  17. for((i=0;i<${#pids[@]};++i));
  18. do
  19. if test ! -d /proc/${pids[i]};
  20. then
  21. wait ${pids[i]}
  22. retcode[${pids[i]}]=$?
  23. else
  24. tmp+=(${pids[i]})
  25. fi
  26. done
  27. pids=(${tmp[@]})
  28. }
  29. set -o monitor
  30. trap "handle_child" CHLD
  31. # Start background processes
  32. OUTPUT1=$(./cocktail -v \
  33. -d "$DOSSIER" \
  34. -p "$PROJET1" \
  35. -b "$URL_BASE" \
  36. -g "$URL_GARDE" 2>&1 >/dev/null) &
  37. pids+=($!)
  38. OUTPUT="START $!"
  39. OUTPUT2=$(./cocktail -v \
  40. -d "$DOSSIER" \
  41. -p "$PROJET2" \
  42. -b "$URL_BASE" \
  43. -g "$URL_GARDE" 2>&1 >/dev/null) &
  44. pids+=($!)
  45. OUTPUT=$(printf "%s\n%s" "$OUTPUT" "START $!")
  46. # Wait until all background processes are stopped
  47. while [ ${#pids[@]} -gt 0 ];
  48. do
  49. OUTPUT=$(printf "%s\n%s %s %s" "$OUTPUT" "WAITING FOR: "${pids[@]})
  50. sleep 4;
  51. done
  52. OUTPUT=$(printf "%s\n%s" "$OUTPUT" "STOPPED")
  53. # affichage des code retour et generation de la chaine de test
  54. for pid in "${!retcode[@]}"
  55. do
  56. statusstring="$statusstring $pid=${retcode[$pid]}"
  57. retcodestr="${retcodestr}${retcode[$pid]}"
  58. done
  59. echo -n "RC $statusstring "
  60. if test "$retcodestr" -eq "00";
  61. then
  62. echo "[ OK ]"
  63. echo "$OUTPUT"
  64. exit 0
  65. else
  66. echo "[FAILED]"
  67. echo "$OUTPUT"
  68. exit 1
  69. fi