change rerendering for zoom 13-14 tiles, change prio for daily rerenderings to be...
[osmrrze.git] / scripts / doosmupdate.sh
CommitLineData
5203e8e5
UO
1#!/bin/bash
2
3LOCKFILE=/home.local/osm/run/.osmupdate.lock
4CHANGESFILE=/home.local/osm/run/osmosis-changes.osc.gz
5EXPIRYFILE=/home.local/osm/run/expiredtiles.lst
6OSMOSISWORKDIR=/home.local/osm/.osmosis
7WEBSTATEFILE=/var/www/lastdbupdate.txt
8# Note: set the expire-tiles to 3 less than the real maximum,
9# as this makes the tilelist MUCH shorter, and the tiles get rerendered
10# anyways due to the metatile-layout!
11UPDATECMD="/usr/bin/osm2pgsql --slim --cache=8000 --append --database=osm \
12 --style=/home.local/osm/dbstyle/osm2pgsql-new.style \
1e28d5c9 13 --flat-nodes=/mnt/database/flatnodes/flatnodes.db \
1ef97ffe 14 --hstore --multi-geometry --expire-tiles=17-17 \
5203e8e5
UO
15 --expire-output=$EXPIRYFILE $CHANGESFILE"
16
17cleanup()
18{
19 rm -f "$LOCKFILE"
20 exit 1
21}
22
23trytofeedupdate()
24{
25 echo "Trying to feed updates into databse..."
26 echo "Executing: $UPDATECMD"
27 $UPDATECMD
28 if [ $? == 0 ] ; then
29 echo "Update went fine, removing changes-file"
30 rm -f $CHANGESFILE
31 else
32 echo "Update failed with error $?"
33 fi
34}
35
36echo "Starting update script: `date`"
37if [ -e "$LOCKFILE" ] ; then
38 echo "Lockfile exists - ABORTING"
39 exit 1
40fi
41touch "$LOCKFILE" || exit 9
42trap cleanup 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 \
43 20 21 22 23 24 25 26 27 28 29 30 31
44if [ -e $CHANGESFILE ] ; then
45 echo "Changesfile exists - will try to feed update to Database"
46 trytofeedupdate
47fi
48if [ -e $CHANGESFILE ] ; then
49 echo "Changesfile STILL exists - ABORTING"
50 cleanup
51 exit 1
52fi
53echo "Downloading changes with OSMOSIS..."
54echo "Executing: /usr/bin/osmosis --read-replication-interval workingDirectory=$OSMOSISWORKDIR --simplify-change --write-xml-change $CHANGESFILE"
55/usr/bin/osmosis --read-replication-interval workingDirectory=$OSMOSISWORKDIR --simplify-change --write-xml-change $CHANGESFILE
56if [ $? != 0 ] ; then
57 echo "Osmosis execution failed. ABORTING"
58 cleanup
59 exit 1
60fi
61trytofeedupdate
62if [ -e $CHANGESFILE ] ; then
63 echo "Changesfile STILL exists - update must have failed. ABORTING"
64 cleanup
65 exit 1
66fi
67echo "Update seems to have been successful."
68grep timestamp $OSMOSISWORKDIR/state.txt | sed -e 's/timestamp=//g' -e 's/T/ /g' -e 's/\\:/:/g' > $WEBSTATEFILE
11f3d002 69echo -n "Updated database: now at upstream state of "
70cat $WEBSTATEFILE
1ef97ffe 71#touch /var/lib/tirex/tiles/planet-import-complete
5203e8e5
UO
72if [ -e $EXPIRYFILE ] ; then
73 echo "Expiryfile exists. Telling tirex to rerender the tiles mentioned there..."
74 echo "Number of lines: `wc -l $EXPIRYFILE`"
1ef97ffe 75 # Used to be zoom 13-20 but that causes too much load. Reduced to 15-20.
5203e8e5 76 cat $EXPIRYFILE | /home.local/osm/bin/osmtilecleanup.pl \
1ef97ffe 77 --action rerenderexpiredlist --zoom 15-20 \
5203e8e5
UO
78 --rrs /home.local/osm/bin/osmrerenderwrapper.sh \
79 /var/lib/tirex/tiles/osm
80 cat $EXPIRYFILE | /home.local/osm/bin/osmtilecleanup.pl \
1ef97ffe 81 --action rerenderexpiredlist --zoom 15-20 \
11f3d002 82 --rrs /home.local/osm/bin/osmrerenderwrapper-osmde.sh \
5203e8e5
UO
83 /var/lib/tirex/tiles/osmde
84 rm $EXPIRYFILE
85fi
86echo "Ending update script cleanly: `date`"
87cleanup
88exit 0
89
This page took 0.054476 seconds and 4 git commands to generate.