ar_redadeg/scripts/synchronize_routing_tables.sh

35 lines
1.7 KiB
Bash
Raw Normal View History

#!/bin/bash
cd data
# dump des tables de routage
2020-02-15 08:32:27 +00:00
pg_dump --file osm_roads_pgr.sql --host localhost --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
2020-02-15 08:32:27 +00:00
pg_dump --file osm_roads_pgr_noded.sql --host localhost --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
2020-02-15 08:32:27 +00:00
pg_dump --file osm_roads_pgr_vertices_pgr.sql --host localhost --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
2019-05-09 08:47:01 +00:00
rm osm_roads_pgr.zip
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
2019-05-09 08:58:02 +00:00
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/ ; \
2019-05-09 08:47:01 +00:00
unzip osm_roads_pgr.zip ; \
2019-05-09 08:58:02 +00:00
psql -U redadeg -d redadeg -c 'DROP TABLE IF EXISTS osm_roads_pgr; DROP TABLE IF EXISTS osm_roads_pgr_noded; DROP TABLE IF EXISTS osm_roads_pgr_vertices_pgr;' ; \
psql -U redadeg -d redadeg < osm_roads_pgr.sql ; \
psql -U redadeg -d redadeg < osm_roads_pgr_noded.sql ; \
2019-05-09 08:47:01 +00:00
psql -U redadeg -d redadeg < osm_roads_pgr_vertices_pgr.sql ;\
rm -f osm_roads_pgr.sql osm_roads_pgr_noded.sql osm_roads_pgr_vertices_pgr.sql ;"