]> git.openstreetmap.org Git - chef.git/blob - cookbooks/taginfo/templates/default/update-planet.erb
Merge remote-tracking branch 'github/pull/183'
[chef.git] / cookbooks / taginfo / templates / default / update-planet.erb
1 #!/bin/sh
2
3 # DO NOT EDIT - This file is being maintained by Chef
4
5 # setup
6
7 PLANETDIR="<%= @directory %>/planet"
8 LOGDIR="${PLANETDIR}/log"
9 PLANETPREV="${PLANETDIR}/planet-previous.pbf"
10 PLANETCURR="${PLANETDIR}/planet.pbf"
11 PLANETNEW="${PLANETDIR}/planet-new.pbf"
12 PLANETTMP="${PLANETDIR}/planet-tmp.pbf"
13
14 # start logging
15
16 exec > "${LOGDIR}/$(date +%Y%m%d-%H%M).log" 2>&1
17
18 pyosmium-up-to-date -v -o $PLANETNEW $PLANETCURR
19 retval=$?
20
21 while [ $retval -eq 1 ]; do
22     mv "$PLANETNEW" "$PLANETTMP"
23     pyosmium-up-to-date -v -o $PLANETNEW $PLANETTMP
24     retval=$?
25     rm "$PLANETTMP"
26 done
27
28 if [ $retval -ne 0 ]; then
29   exit $retval
30 fi
31
32 # cleanup
33
34 mv "$PLANETCURR" "$PLANETPREV"
35 mv "$PLANETNEW" "$PLANETCURR"
36
37 # expire old logs
38
39 find "${LOGDIR}" -mtime +28 -delete