diff --git a/analyse-bano.sh b/analyse-bano.sh index 4408a8e..ab3c3ab 100755 --- a/analyse-bano.sh +++ b/analyse-bano.sh @@ -127,7 +127,7 @@ echo " echo "" echo "sending to osmose frontend" -curl -v --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" && echo -e "\n\rcurl ok" || echo -e "\n\rcurl ko" +send_frontend $OUT done @@ -213,4 +213,4 @@ done echo " " | gzip -9 >> $OUT -curl -s --request POST --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/analyse-sirene.sh b/analyse-sirene.sh index 96540fc..af0b6ae 100755 --- a/analyse-sirene.sh +++ b/analyse-sirene.sh @@ -24,5 +24,5 @@ select format(' " >> $OUT -curl -s --request POST --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/analyse_volta_lignes_RTE.sh b/analyse_volta_lignes_RTE.sh index 550f955..cb5b402 100755 --- a/analyse_volta_lignes_RTE.sh +++ b/analyse_volta_lignes_RTE.sh @@ -46,7 +46,5 @@ from ( echo " " | gzip -9 >> $OUT -curl --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" -sleep 30 -curl --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/analyse_volta_postes.sh b/analyse_volta_postes.sh index a49c1a0..696858c 100755 --- a/analyse_volta_postes.sh +++ b/analyse_volta_postes.sh @@ -81,7 +81,4 @@ done echo " " | gzip -9 >> $OUT -curl --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" -sleep 30 -curl --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" - +send_frontend $OUT diff --git a/analyzer-admin-express.sh b/analyzer-admin-express.sh index d0ffff2..621121a 100755 --- a/analyzer-admin-express.sh +++ b/analyzer-admin-express.sh @@ -30,4 +30,4 @@ echo " " >> $OUT -curl -s --request POST --compressed --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/analyzer-cadastre.sh b/analyzer-cadastre.sh index 249e0cd..097c3e9 100755 --- a/analyzer-cadastre.sh +++ b/analyzer-cadastre.sh @@ -51,4 +51,4 @@ echo " " >> $OUT -curl -s --request POST --compressed --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/analyzer-missing-road.sh b/analyzer-missing-road.sh index 6d1b59a..740e560 100755 --- a/analyzer-missing-road.sh +++ b/analyzer-missing-road.sh @@ -33,4 +33,4 @@ echo " " >> $OUT -curl -s --request POST --compressed --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/analyzer-no-road-near-address.sh b/analyzer-no-road-near-address.sh index c228ab7..cba02e9 100755 --- a/analyzer-no-road-near-address.sh +++ b/analyzer-no-road-near-address.sh @@ -38,4 +38,4 @@ echo " " >> $OUT -curl -s --request POST --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/analyzer-no-road-near-building.sh b/analyzer-no-road-near-building.sh index 8288e87..895168d 100755 --- a/analyzer-no-road-near-building.sh +++ b/analyzer-no-road-near-building.sh @@ -39,4 +39,4 @@ echo " " >> $OUT -curl -s --request POST --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/analyzer-no-road-near-voirie.sh b/analyzer-no-road-near-voirie.sh index 528e5cd..7f458d5 100755 --- a/analyzer-no-road-near-voirie.sh +++ b/analyzer-no-road-near-voirie.sh @@ -40,4 +40,4 @@ echo " " >> $OUT echo "Envoi" -curl -s --request POST --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/analyzer-qa-missing-buildings.sh b/analyzer-qa-missing-buildings.sh index b9fd0db..12eac7b 100755 --- a/analyzer-qa-missing-buildings.sh +++ b/analyzer-qa-missing-buildings.sh @@ -46,4 +46,4 @@ echo " " >> $OUT -curl -s --request POST --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/analyzer-qa-missing-highways.sh b/analyzer-qa-missing-highways.sh index efd703f..69ac09e 100755 --- a/analyzer-qa-missing-highways.sh +++ b/analyzer-qa-missing-highways.sh @@ -28,7 +28,7 @@ echo " " >> $OUT -curl -s --request POST --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT "${URL_FRONTEND_UPDATE}" +send_frontend $OUT echo " @@ -54,4 +54,4 @@ echo " " >> $OUT -curl -s --request POST --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/analyzer-qa-missing-route500.sh b/analyzer-qa-missing-route500.sh index b25cdee..5ff5c62 100755 --- a/analyzer-qa-missing-route500.sh +++ b/analyzer-qa-missing-route500.sh @@ -35,4 +35,4 @@ echo " " >> $OUT -curl -s --request POST --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/analyzer-qa-route500-lanes.sh b/analyzer-qa-route500-lanes.sh index c83aef2..e786d84 100755 --- a/analyzer-qa-route500-lanes.sh +++ b/analyzer-qa-route500-lanes.sh @@ -30,4 +30,4 @@ echo " " >> $OUT -curl -s --request POST --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/analyzer-road-name-ref.sh b/analyzer-road-name-ref.sh index 05dcf9e..d7225c5 100755 --- a/analyzer-road-name-ref.sh +++ b/analyzer-road-name-ref.sh @@ -31,4 +31,4 @@ echo " " >> $OUT -curl -s --request POST --compressed --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/bdtopo/analyse_highway_bdtopo.sh b/bdtopo/analyse_highway_bdtopo.sh index 97de48b..54402bd 100755 --- a/bdtopo/analyse_highway_bdtopo.sh +++ b/bdtopo/analyse_highway_bdtopo.sh @@ -59,9 +59,4 @@ done echo " " | gzip -9 >> $OUT -#exit - -curl --form source="opendata_xref-france" --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" -sleep 30 -curl --form source="opendata_xref-france" --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" - +send_frontend $OUT diff --git a/bdtopo/analyse_highway_decale.sh b/bdtopo/analyse_highway_decale.sh index 7703b54..47337c2 100755 --- a/bdtopo/analyse_highway_decale.sh +++ b/bdtopo/analyse_highway_decale.sh @@ -69,7 +69,5 @@ done echo " " | gzip -9 >> $OUT -curl --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" -sleep 30 -curl --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/bdtopo/analyse_highway_lanes_bdtopo.sh b/bdtopo/analyse_highway_lanes_bdtopo.sh index e0d8a90..78082ac 100755 --- a/bdtopo/analyse_highway_lanes_bdtopo.sh +++ b/bdtopo/analyse_highway_lanes_bdtopo.sh @@ -49,7 +49,4 @@ from ( echo " " | gzip -9 >> $OUT -curl --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" -sleep 30 -curl --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" - +send_frontend $OUT diff --git a/bdtopo/analyse_waterway_bdtopo.sh b/bdtopo/analyse_waterway_bdtopo.sh index b187d62..4186757 100755 --- a/bdtopo/analyse_waterway_bdtopo.sh +++ b/bdtopo/analyse_waterway_bdtopo.sh @@ -46,8 +46,4 @@ from ( echo " " | gzip -9 >> $OUT -curl --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" -sleep 300 -curl --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" - - +send_frontend $OUT diff --git a/cadastre/analyse_voies_cadastre.sh b/cadastre/analyse_voies_cadastre.sh index 191092c..c0f4b8b 100755 --- a/cadastre/analyse_voies_cadastre.sh +++ b/cadastre/analyse_voies_cadastre.sh @@ -54,4 +54,4 @@ done echo " " | gzip -9 >> $OUT -curl -v --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" +send_frontend $OUT diff --git a/config.sh b/config.sh index 7ffee1f..6494d03 100755 --- a/config.sh +++ b/config.sh @@ -11,3 +11,24 @@ else fi export URL_FRONTEND_UPDATE="https://osmose.openstreetmap.fr/control/send-update" + +send_frontend() { + $OUT = $1 + tries = 0 + + echo "Sending result" + + until [ "$tries" -ge 3 ]; do + tries=$(( $tries + 1 )) + echo "Try: '$tries'" + curl -s --request POST --form source='opendata_xref-france' --form code="$OSMOSEPASS" --form content=@$OUT -H 'Host: osmose.openstreetmap.fr' "${URL_FRONTEND_UPDATE}" && break + sleep 300 + done + + if [ "$tries" -eq 4 ]; do + echo "Impossible to send results" + exit 1 + done + + return +}