3 # DO NOT EDIT - This file is being maintained by Chef
11 PLANETDIR="<%= @directory %>/planet"
12 LOGDIR="${PLANETDIR}/log"
13 PLANETPREV="${PLANETDIR}/planet-previous.pbf"
14 PLANETCURR="${PLANETDIR}/planet.pbf"
15 PLANETNEW="${PLANETDIR}/planet-new.pbf"
16 STATEDIR="${PLANETDIR}/replication"
17 OSCFILE="${PLANETDIR}/$(date +%Y%m%d-%H%M).osc"
18 OSCFILEPREV="${PLANETDIR}/previous.osc"
20 OSMIUM=<%= @directory %>/osmium-tool/build/src/osmium
24 exec > "${LOGDIR}/$(date +%Y%m%d-%H%M).log" 2>&1
26 # if there are old .osc files, they have to be taken into account
28 OLDFILE="$(find "${PLANETDIR}" -name "2*-*.osc" -print)"
31 osmosis --rri "$STATEDIR" --simc --write-xml-change "$OSCFILE"
33 osmosis --rxc "$OLDFILE" --rri "$STATEDIR" --mc --simc --write-xml-change "$OSCFILE" && rm "$OLDFILE"
36 # osc file is ready, create new planet file
38 #osmosis --read-xml-change "$OSCFILE" --read-bin "$PLANETCURR" --buffer bufferCapacity=12000 --apply-change --buffer bufferCapacity=12000 --write-pbf file="$PLANETNEW"
39 $OSMIUM apply-changes --verbose --fsync --output=$PLANETNEW $PLANETCURR $OSCFILE
43 mv "$PLANETCURR" "$PLANETPREV"
44 mv "$PLANETNEW" "$PLANETCURR"
45 mv "$OSCFILE" "$OSCFILEPREV"
49 find "${LOGDIR}" -mtime +28 -delete