]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/taginfo/templates/default/update-planet.erb
On taginfo server: Keep last planet and change file around after update.
[chef.git] / cookbooks / taginfo / templates / default / update-planet.erb
index 76b7af27364d063a1fd3fc3f9aaac35badf768ea..371369b07cc4a2cb50c159e0a8e51088364b9d6e 100644 (file)
@@ -10,10 +10,12 @@ set -e
 
 PLANETDIR="<%= @directory %>/planet"
 LOGDIR="${PLANETDIR}/log"
-PLANETOLD="${PLANETDIR}/planet.pbf"
+PLANETPREV="${PLANETDIR}/planet-previous.pbf"
+PLANETCURR="${PLANETDIR}/planet.pbf"
 PLANETNEW="${PLANETDIR}/planet-new.pbf"
 STATEDIR="${PLANETDIR}/replication"
 OSCFILE="${PLANETDIR}/$(date +%Y%m%d-%H%M).osc"
+OSCFILEPREV="${PLANETDIR}/previous.osc"
 
 # start logging
 
@@ -31,12 +33,13 @@ fi
 
 # osc file is ready, create new planet file
 
-osmosis --read-xml-change "$OSCFILE" --read-bin "$PLANETOLD" --buffer bufferCapacity=12000 --apply-change --buffer bufferCapacity=12000 --write-pbf file="$PLANETNEW"
+osmosis --read-xml-change "$OSCFILE" --read-bin "$PLANETCURR" --buffer bufferCapacity=12000 --apply-change --buffer bufferCapacity=12000 --write-pbf file="$PLANETNEW"
 
 # cleanup
 
-mv "$PLANETNEW" "$PLANETOLD"
-rm "$OSCFILE"
+mv "$PLANETCURR" "$PLANETPREV"
+mv "$PLANETNEW" "$PLANETCURR"
+mv "$OSCFILE" "$OSCFILEPREV"
 
 # expire old logs