X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/2bfb0ef07fb64314f5c4ded641a8c280df9c1d0b..ec4ff72f33f13089bc2f3cd64087ece880eb5135:/cookbooks/planet/templates/default/planet-update.erb?ds=sidebyside diff --git a/cookbooks/planet/templates/default/planet-update.erb b/cookbooks/planet/templates/default/planet-update.erb index 4c00592b9..73a778bba 100644 --- a/cookbooks/planet/templates/default/planet-update.erb +++ b/cookbooks/planet/templates/default/planet-update.erb @@ -2,18 +2,30 @@ # DO NOT EDIT - This file is being maintained by Chef -exec >> /var/log/planet-update.log 2>&1 +# setup -echo "Updating planet file..." +SUFFIX="osh.pbf" -/sbin/runuser -u planet -- /usr/local/bin/planet-update-file +PLANETDIR="/var/lib/planet" +PLANETPREV="${PLANETDIR}/planet-previous.${SUFFIX}" +PLANETCURR="${PLANETDIR}/planet.${SUFFIX}" +PLANETNEW="${PLANETDIR}/planet-new.${SUFFIX}" -echo "Running jobs..." -<% node[:planet][:current][:jobs].each_value do |job| -%> +pyosmium-up-to-date -vvv -o "$PLANETNEW" "$PLANETCURR" +retval=$? -echo "Running '<%= job[:command] %>' as user '<%= job[:user] %>'..." +while [ $retval -eq 1 ]; do + mv "$PLANETCURR" "$PLANETPREV" + mv "$PLANETNEW" "$PLANETCURR" + pyosmium-up-to-date -vvv -o "$PLANETNEW" "$PLANETCURR" + retval=$? +done -/sbin/runuser -u "<%= job[:user] %>" -- "<%= job[:command] %>" -<% end -%> +if [ $retval -ne 0 ]; then + exit $retval +fi -echo "Done." +# cleanup + +mv "$PLANETCURR" "$PLANETPREV" +mv "$PLANETNEW" "$PLANETCURR"