Commit 96d4bd45 authored by U-PALLAS\theron's avatar U-PALLAS\theron
Browse files

Modification gestion des rep SUCCES et REJETS

parent 3bb2eb34
Cines_test_ko.tar
Cines_test_ok.tar
Cines_test_ok_2.tar
Cines_test_ok_3.tar
#!/bin/sh
curl -X POST -k -H 'X-Tenant-Id: 0' -H 'Content-Type: application/octet-stream' -H 'X-Access-Contract-Id: CE-000000' -H 'X-Context-Id: DEFAULT_WORKFLOW' -H 'X-Action: RESUME' -H 'X-SSL-CLIENT-CERT: -----BEGIN CERTIFICATE----- '$1' -----END CERTIFICATE-----' -H 'Accept: */*' -i ''$4'/ingest-external/v1/ingests' --data-binary @$2/$5/$3 > ./out/$2-$3-POST.out
curl -X POST -k -H 'X-Tenant-Id: 0' -H 'Content-Type: application/octet-stream' -H 'X-Access-Contract-Id: CE-000000' -H 'X-Context-Id: DEFAULT_WORKFLOW' -H 'X-Action: RESUME' -H 'X-SSL-CLIENT-CERT: -----BEGIN CERTIFICATE----- '$1' -----END CERTIFICATE-----' -H 'Accept: */*' -i ''$4'/ingest-external/v1/ingests' --data-binary @$2/$3 > ./out/$2-$3-POST.out
......@@ -98,8 +98,8 @@ report="ETAT";j=0;flagSt=0;
echo "$dateVers $sip $reqId $statutPost $etatFinal" >> ./out/$1-$report.out;
# Move dans SUCCESS ou REJETS selon valeur de $etatfinal:
case $etatFinal in
OK) mv $1/SIP/$sip $1/SUCCES;;
KO) mv $1/SIP/$sip $1/REJETS;;
OK) mv $1/$sip $1/SUCCES;;
KO) mv $1/$sip $1/REJETS;;
esac
done
}
......@@ -107,20 +107,25 @@ report="ETAT";j=0;flagSt=0;
post_sip () {
report="POST";
echo "rep des sip: $path_sip";
# Lancement des POST (versement des SIP de la directory $path_sip)
ls $1/SIP > $1/fichier_liste_sip.txt
nbrSip=`cat $1/fichier_liste_sip.txt | wc -l`
ls -l $path_sip | egrep -v '^d' | awk {'print $9'} > $path_sip/fichier_liste_sip.txt #liste ss les dir
# ls $1 > $1/fichier_liste_sip.txt #**
nbrSip=`cat $path_sip/fichier_liste_sip.txt | wc -l`
# Boucle de lecture , lancement des POST, enregistrement des Request-id des POST
exec 0<$1/fichier_liste_sip.txt
exec 0<$path_sip/fichier_liste_sip.txt
tot=0;
z=1;
echo "`date +%Y/%m/%d-%H:%M:%S`: Versement des SIP de $path_sip dans VITAM ..." > ./out/$path_sip-$report.out
read sip # lecture de la 1ere ligne vide de fichier_liste_sip.txt
while read sip
do
echo "`date +%Y/%m/%d-%H:%M:%S`: Versement du SIP $path_sip/$sip dans VITAM ..."
$path_curl/curl_POST.sh $certificat $path_sip $sip $url$ing_ext_port SIP
$path_curl/curl_POST.sh $certificat $path_sip $sip $url$ing_ext_port
#####
## Recuperation du code retour HTTP et du X-request-Id dans la sortie du POST
......@@ -155,6 +160,18 @@ report="POST";
## Boucle: pour chaque ligne: recuperation de l'ATR et parse de <replyCOde> > fichier ETAT final
## Fin
# Construction des repertoires si il n'existent pas
if [[ ! -d $path_sip/SUCCES ]]
then
mkdir -p $path_sip/SUCCES;
fi
if [[ ! -d $path_sip/REJETS ]]
then
mkdir -p $path_sip/REJETS;
fi
# Lancement du traitement
case $2 in
POST) post_sip $path_sip;;
STATUT) recup_statut $path_sip;;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment