X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/86edbbca8af9903fca18dbb20a6ea2ca62e7d97c..45da35a6ec300900fc35596afe37871f1b4a589b:/cookbooks/taginfo/templates/default/update-planet.erb?ds=sidebyside diff --git a/cookbooks/taginfo/templates/default/update-planet.erb b/cookbooks/taginfo/templates/default/update-planet.erb index 3a96141a7..7f55c078c 100644 --- a/cookbooks/taginfo/templates/default/update-planet.erb +++ b/cookbooks/taginfo/templates/default/update-planet.erb @@ -10,10 +10,14 @@ 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" + +OSMIUM=<%= @directory %>/osmium-tool/build/src/osmium # start logging @@ -31,9 +35,15 @@ 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 omitmetadata=true file="$PLANETNEW" +#osmosis --read-xml-change "$OSCFILE" --read-bin "$PLANETCURR" --buffer bufferCapacity=12000 --apply-change --buffer bufferCapacity=12000 --write-pbf file="$PLANETNEW" +$OSMIUM apply-changes --verbose --fsync --output=$PLANETNEW $PLANETCURR $OSCFILE # cleanup -mv "$PLANETNEW" "$PLANETOLD" -rm "$OSCFILE" +mv "$PLANETCURR" "$PLANETPREV" +mv "$PLANETNEW" "$PLANETCURR" +mv "$OSCFILE" "$OSCFILEPREV" + +# expire old logs + +find "${LOGDIR}" -mtime +28 -delete