3 # DO NOT EDIT - This file is being maintained by Chef
11 PLANETDIR="<%= @directory %>/planet"
12 LOGDIR="${PLANETDIR}/log"
13 PLANETOLD="${PLANETDIR}/planet.pbf"
14 PLANETNEW="${PLANETDIR}/planet-new.pbf"
15 STATEDIR="${PLANETDIR}/replication"
16 OSCFILE="${PLANETDIR}/$(date +%Y%m%d-%H%M).osc"
20 exec > "${LOGDIR}/$(date +%Y%m%d-%H%M).log" 2>&1
22 # if there are old .osc files, they have to be taken into account
24 OLDFILE="$(find "${PLANETDIR}" -name "2*-*.osc" -print)"
27 osmosis --rri "$STATEDIR" --simc --write-xml-change "$OSCFILE"
29 osmosis --rxc "$OLDFILE" --rri "$STATEDIR" --mc --simc --write-xml-change "$OSCFILE" && rm "$OLDFILE"
32 # osc file is ready, create new planet file
34 osmosis --read-xml-change "$OSCFILE" --read-bin "$PLANETOLD" --buffer bufferCapacity=12000 --apply-change --buffer bufferCapacity=12000 --write-pbf omitmetadata=true file="$PLANETNEW"
38 mv "$PLANETNEW" "$PLANETOLD"