-#!/bin/sh
+#!/bin/bash
echo "Daily maintenance starting: `date`"
# Delete tiles in zoomlevel 13-14 that are older than 336 hours = 14 days
sudo -u tirex -- /home.local/osm/bin/osmtilecleanup.pl --zoom 10-20 --action delete --rmemptydirs --minage 24 /var/lib/tirex/tiles/rrze-ovl
# Regenerate a part of zoomlevel 0-12 tiles. There are at most 350000 such tiles.
# At 5000 a day, it'll take 70 days to regenerate all. As they hardly ever change, that should be fine.
+export PRIO=31
/home.local/osm/bin/osmtilecleanup.pl --zoom 0-12 --action rerender \
--limit 5000 --rrs /home.local/osm/bin/osmrerenderwrapper.sh /var/lib/tirex/tiles/osm
/home.local/osm/bin/osmtilecleanup.pl --zoom 0-12 --action rerender \
--limit 5000 --rrs /home.local/osm/bin/osmrerenderwrapper-osmde.sh /var/lib/tirex/tiles/osmde
+# Regenerate (part of) zoomlevel 13-14 tiles. Some of these are pretty expensive, so
+# we rather rerender them scheduled than when they change (usually they really don't,
+# it is 99 percent false alerts).
+/home.local/osm/bin/osmtilecleanup.pl --zoom 13-14 --action rerender \
+ --limit 1000 --rrs /home.local/osm/bin/osmrerenderwrapper.sh /var/lib/tirex/tiles/osm
+/home.local/osm/bin/osmtilecleanup.pl --zoom 13-14 --action rerender \
+ --limit 1000 --rrs /home.local/osm/bin/osmrerenderwrapper-osmde.sh /var/lib/tirex/tiles/osmde
# Update tile stats for munin
tirex-tiledir-check --stats=/var/lib/tirex/stats/tiles-osm.stats osm
tirex-tiledir-check --stats=/var/lib/tirex/stats/tiles-osmde.stats osmde
fi
# Rerender Erlangen / Nuernberg. Around 4000 tiles, takes around 30 minutes.
-tirex-batch --prio=22 --expire=+14400 map=osm bbox=10.93,49.37,11.14,49.63 z=13-19
-tirex-batch --prio=22 --expire=+14400 map=osmde bbox=10.93,49.37,11.14,49.63 z=13-19
+tirex-batch --prio=${PRIO} --expire=+14400 map=osm bbox=10.93,49.37,11.14,49.63 z=13-19
+tirex-batch --prio=${PRIO} --expire=+14400 map=osmde bbox=10.93,49.37,11.14,49.63 z=13-19
echo "Daily maintenance finished: `date`"
UPDATECMD="/usr/bin/osm2pgsql --slim --cache=8000 --append --database=osm \
--style=/home.local/osm/dbstyle/osm2pgsql-new.style \
--flat-nodes=/mnt/database/flatnodes/flatnodes.db \
- --hstore --expire-tiles=17-17 \
+ --hstore --multi-geometry --expire-tiles=17-17 \
--expire-output=$EXPIRYFILE $CHANGESFILE"
cleanup()
grep timestamp $OSMOSISWORKDIR/state.txt | sed -e 's/timestamp=//g' -e 's/T/ /g' -e 's/\\:/:/g' > $WEBSTATEFILE
echo -n "Updated database: now at upstream state of "
cat $WEBSTATEFILE
-touch /var/lib/tirex/tiles/planet-import-complete
+#touch /var/lib/tirex/tiles/planet-import-complete
if [ -e $EXPIRYFILE ] ; then
echo "Expiryfile exists. Telling tirex to rerender the tiles mentioned there..."
echo "Number of lines: `wc -l $EXPIRYFILE`"
+ # Used to be zoom 13-20 but that causes too much load. Reduced to 15-20.
cat $EXPIRYFILE | /home.local/osm/bin/osmtilecleanup.pl \
- --action rerenderexpiredlist --zoom 13-20 \
+ --action rerenderexpiredlist --zoom 15-20 \
--rrs /home.local/osm/bin/osmrerenderwrapper.sh \
/var/lib/tirex/tiles/osm
cat $EXPIRYFILE | /home.local/osm/bin/osmtilecleanup.pl \
- --action rerenderexpiredlist --zoom 13-20 \
+ --action rerenderexpiredlist --zoom 15-20 \
--rrs /home.local/osm/bin/osmrerenderwrapper-osmde.sh \
/var/lib/tirex/tiles/osmde
rm $EXPIRYFILE