123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #!/bin/bash
- printf "$PRINTFPATTERN" $0 : "2 Compilations. 1 Dossier. 2 Projets. Pad Privé. export/txt"
- if test "$TRAVIS" == "true";
- then
- echo "[ SKIP ]"
- exit 99
- fi
- URL_BASE=https%3A%2F%2Fpad.exegetes.eu.org%2Fgroup.html%2F19%2Fpad.html%2Fg.STVKtWnA83RsmVUC%24Abro2-PRIVE%2Fexport%2Ftxt
- URL_GARDE=https%3A%2F%2Fpad.exegetes.eu.org%2Fgroup.html%2F19%2Fpad.html%2Fg.STVKtWnA83RsmVUC%24Abro2Garde-PRIVE%2Fexport%2Ftxt
- DOSSIER=MonDossier$$
- PROJET1=Abro2$$
- PROJET2=Abro3
- # pids conserve la liste des pids
- # retcode conserve le code retour de chaque pid une fois terminé
- handle_child() {
- local tmp=()
- for((i=0;i<${#pids[@]};++i));
- do
- if test ! -d /proc/${pids[i]};
- then
- wait ${pids[i]}
- retcode[${pids[i]}]=$?
- else
- tmp+=(${pids[i]})
- fi
- done
- pids=(${tmp[@]})
- }
- set -o monitor
- trap "handle_child" CHLD
- # Start background processes
- OUTPUT1=$(./cocktail -v \
- -d "$DOSSIER" \
- -p "$PROJET1" \
- -b "$URL_BASE" \
- -g "$URL_GARDE" 2>&1 >/dev/null) &
- pids+=($!)
- OUTPUT="START $!"
- OUTPUT2=$(./cocktail -v \
- -d "$DOSSIER" \
- -p "$PROJET2" \
- -b "$URL_BASE" \
- -g "$URL_GARDE" 2>&1 >/dev/null) &
- pids+=($!)
- OUTPUT=$(printf "%s\n%s" "$OUTPUT" "START $!")
- # Wait until all background processes are stopped
- while [ ${#pids[@]} -gt 0 ];
- do
- OUTPUT=$(printf "%s\n%s %s %s" "$OUTPUT" "WAITING FOR: "${pids[@]})
- sleep 4;
- done
- OUTPUT=$(printf "%s\n%s" "$OUTPUT" "STOPPED")
- # affichage des code retour et generation de la chaine de test
- for pid in "${!retcode[@]}"
- do
- statusstring="$statusstring $pid=${retcode[$pid]}"
- retcodestr="${retcodestr}${retcode[$pid]}"
- done
- echo -n "RC $statusstring "
- if test "$retcodestr" -eq "00";
- then
- echo "[ OK ]"
- echo "$OUTPUT"
- exit 0
- else
- echo "[FAILED]"
- echo "$OUTPUT"
- exit 1
- fi
|