source: subversion/sites/www.openstreetbrowser.org/do_all_live @ 17958

Last change on this file since 17958 was 17958, checked in by skunk, 10 years ago

Use custom temp-directory

  • Avoid filling /tmp
  • /tmp usually gets deleted at reboot
  • Property svn:executable set to *
File size: 3.3 KB
Line 
1#!/bin/bash
2
3# This script is used in the live database
4# The import happens in a new database called 'gisnew'
5# When everything is finished the old database 'gis' is renamed to 'gisold' (in
6# case something went wrong, it can be drop later or when do_all_live is called
7# the next time) and 'gisnew' renamed to 'gis'
8
9export ROOT_PATH=/osm/osm
10export SOFTWARE_PATH=/osm/osm/software
11export DB_NAME=gisnew
12
13echo "=== Starting Database reload. Press key to continue."
14read
15
16echo "* SVN - Update database import"
17svn update src/
18
19echo "* Download new OSM-File"
20cd $ROOT_PATH/data
21wget -N http://download.geofabrik.de/osm/europe.osm.bz2
22
23echo "* Importing to Database"
24echo "- prepare osm2pgsql"
25cd $SOFTWARE_PATH/osm2pgsql
26psql -d gis -c "drop database gisold"
27psql -d gis -c "drop database gisnew"
28psql -d gis -c "create database gisnew"
29psql -d gisnew -c "create language plpgsql"
30psql -d gisnew -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
31psql -d gisnew -f /usr/share/postgresql/8.3/contrib/_int.sql
32echo "= osm2pgsql"
33./osm2pgsql -c -s -m -d $DB_NAME ~/data/europe.osm.bz2
34echo "= osmosis"
35echo "- init db for osmosis"
36psql $DB_NAME < ~/src/pgsql_simple_schema.sql
37cd $ROOT_PATH/data/
38~skunkosm/software/osmosis-current/bin/osmosis --read-xml ~/data/europe.osm.bz2 --write-pgsql-dump
39cd pgimport
40echo "- drop unneeded geometry"
41cut -f1-3 nodes.txt > nodes1.txt
42mv nodes1.txt nodes.txt
43echo "- load db from osmosis"
44psql $DB_NAME < ~/src/pgsql_simple_load.sql
45
46echo "finished import - next preprocess"
47# read
48
49echo "* Preprocessing data"
50cd $ROOT_PATH
51for i in src/sql/*.sql ; do echo "Executing $i ..." ; psql $DB_NAME < $i ; done
52
53echo "=== Preprocessing finsished. Press key to continue"
54read
55
56echo "* SVN - Update style"
57svn update conf.php render/
58
59export DB_NAME=gis
60
61echo "* Update style-sheet"
62export TMPDIR="/osm/`whoami`-style/`date +%Y%m%d-%H%M`"
63mkdir -p $TMPDIR
64echo "BASE"
65echo "Layers"
66cd $ROOT_PATH/render
67./gen_rotate_img.php
68./gen_layer.php > layers.mml
69cd $SOFTWARE_PATH/cascadenik
70$ROOT_PATH/src/combine_cascadenik.pl > $ROOT_PATH/render/base.xml
71echo "PT"
72cd $ROOT_PATH/render
73convert -background none img/src/stop_p_back.svg img/stop_p_back.png
74convert -background none img/src/stop_p_for.svg img/stop_p_for.png
75convert -background none img/src/stop_n_back.svg img/stop_n_back.png
76convert -background none img/src/stop_n_for.svg img/stop_n_for.png
77convert -background none img/src/stop.svg img/stop.png
78cascadenik-compile.py $ROOT_PATH/render/overlay_pt.mml > $ROOT_PATH/render/overlay_pt.xml
79$ROOT_PATH/src/update_xml.pl $ROOT_PATH/render/overlay_pt.xml
80./create_rotate_style
81echo "CH"
82cascadenik-compile.py $ROOT_PATH/render/overlay_ch.mml > $ROOT_PATH/render/overlay_ch.xml
83$ROOT_PATH/src/update_xml.pl $ROOT_PATH/render/overlay_ch.xml
84echo "CAR"
85cascadenik-compile.py $ROOT_PATH/render/overlay_car.mml > $ROOT_PATH/render/overlay_car.xml
86$ROOT_PATH/src/update_xml.pl $ROOT_PATH/render/overlay_car.xml
87echo "WIKI Style"
88cd $ROOT_PATH
89$ROOT_PATH/src/gen_mss_from_wiki.php
90
91echo "=== Updated Style. Press key to continue"
92read
93
94echo "* SVN - Updating rest of code"
95svn update
96
97killall renderd
98
99psql -d gisnew -c "alter database gis rename to gisold"
100psql -d gisold -c "alter database gisnew rename to gis"
101touch /osm/tiles/planet-import-complete
102
103cd $ROOT_PATH
104./software/mod_tile/mod_tile/renderd
Note: See TracBrowser for help on using the repository browser.