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"
22 exec > "${LOGDIR}/$(date +%Y%m%d-%H%M).log" 2>&1
24 # if there are old .osc files, they have to be taken into account
26 OLDFILE="$(find "${PLANETDIR}" -name "2*-*.osc" -print)"
29 osmosis --rri "$STATEDIR" --simc --write-xml-change "$OSCFILE"
31 osmosis --rxc "$OLDFILE" --rri "$STATEDIR" --mc --simc --write-xml-change "$OSCFILE" && rm "$OLDFILE"
34 # osc file is ready, create new planet file
36 osmosis --read-xml-change "$OSCFILE" --read-bin "$PLANETCURR" --buffer bufferCapacity=12000 --apply-change --buffer bufferCapacity=12000 --write-pbf file="$PLANETNEW"
40 mv "$PLANETCURR" "$PLANETPREV"
41 mv "$PLANETNEW" "$PLANETCURR"
42 mv "$OSCFILE" "$OSCFILEPREV"
46 find "${LOGDIR}" -mtime +28 -delete