]> git.openstreetmap.org Git - chef.git/blob - cookbooks/taginfo/templates/default/update-planet.erb
Convert cplanet to be a recipe in the planet cookbook
[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
13 # start logging
14
15 exec > "${LOGDIR}/$(date +%Y%m%d-%H%M).log" 2>&1
16
17 retval=1
18 while [ $retval -eq 1 ]; do
19     pyosmium-up-to-date -v -o $PLANETNEW $PLANETCURR
20     retval=$?
21 done
22
23 if [ $retval -ne 0 ]; then
24   exit $retval
25 fi
26
27 # cleanup
28
29 mv "$PLANETCURR" "$PLANETPREV"
30 mv "$PLANETNEW" "$PLANETCURR"
31
32 # expire old logs
33
34 find "${LOGDIR}" -mtime +28 -delete