From 4b6e14c1d656b46168dcde362c68721f73029d44 Mon Sep 17 00:00:00 2001 From: MaelReboux Date: Thu, 9 May 2019 10:18:16 +0200 Subject: [PATCH] Create synchronize_routing_tables.sh script pour maj les tables de routage du serveur depuis un ordi local --- scripts/synchronize_routing_tables.sh | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 scripts/synchronize_routing_tables.sh diff --git a/scripts/synchronize_routing_tables.sh b/scripts/synchronize_routing_tables.sh new file mode 100644 index 0000000..699029e --- /dev/null +++ b/scripts/synchronize_routing_tables.sh @@ -0,0 +1,40 @@ +#!/bin/bash + + + +cd data + +# dump des tables de routage + +#pg_dump --file osm_roads.sql --host localhost --port 5432 --username osmbr \ +#--no-password --verbose --format=p --no-owner --section=pre-data --section=data --no-privileges --no-tablespaces --no-unlogged-table-data --no-comments \ +#--table public.osm_roads osm + +pg_dump --file osm_roads_pgr.sql --host 192.168.56.131 --port 5432 --username redadeg \ +--no-password --verbose --format=p --no-owner --section=pre-data --section=data --no-privileges --no-tablespaces --no-unlogged-table-data --no-comments \ +--table public.osm_roads_pgr redadeg + +pg_dump --file osm_roads_pgr_noded.sql --host 192.168.56.131 --port 5432 --username redadeg \ +--no-password --verbose --format=p --no-owner --section=pre-data --section=data --no-privileges --no-tablespaces --no-unlogged-table-data --no-comments \ +--table public.osm_roads_pgr_noded redadeg + +pg_dump --file osm_roads_pgr_vertices_pgr.sql --host 192.168.56.131 --port 5432 --username redadeg \ +--no-password --verbose --format=p --no-owner --section=pre-data --section=data --no-privileges --no-tablespaces --no-unlogged-table-data --no-comments \ +--table public.osm_roads_pgr_vertices_pgr redadeg + + +# on zippe +zip osm_roads_pgr.zip osm_roads_pgr.sql osm_roads_pgr_noded.sql osm_roads_pgr_vertices_pgr.sql + +# on envoi sur le serveur +rsync -av --progress osm_roads_pgr.zip breizhpovh2:/data/www/vhosts/ar-redadeg_openstreetmap_bzh/htdocs/scripts/data/ + +# on envoie des commande pour maj les tables de routage +ssh breizhpovh2 "cd /data/www/vhosts/ar-redadeg_openstreetmap_bzh/htdocs/scripts/data/ ; \ +rm osm_roads_pgr.zip osm_roads_pgr.sql osm_roads_pgr_noded.sql osm_roads_pgr_vertices_pgr.sql \ +unzip -f osm_roads_pgr.zip ; \ +psql -U redadeg -d redadeg -c 'DROP TABLE osm_roads_pgr; DROP TABLE osm_roads_pgr_noded; DROP TABLE osm_roads_pgr_vertices_pgr;' +psql -U redadeg -d redadeg < osm_roads_pgr.sql ; \ +psql -U redadeg -d redadeg < osm_roads_pgr_noded.sql ; \ +psql -U redadeg -d redadeg < osm_roads_pgr_vertices_pgr.sql" +