3 PYOSMIUM="pyosmium-get-changes --server <%= node[:overpass][:replication_url] %> -f <%= @basedir %>/db/replicate-id"
 
   4 <% if node[:overpass][:meta_mode] == "attic" -%>
 
   5 PYOSMIUM="$PYOSMIUM --no-deduplicate"
 
   8 <% if node[:overpass][:meta_mode] == "meta" -%>
 
  10 <% elsif node[:overpass][:meta_mode] == "attic" -%>
 
  17   status=3 # make it sleep on issues
 
  19   if [ -f <%= @basedir %>/db/replicate-id ]; then
 
  20     # first apply any pending updates
 
  21     if [ -f <%= @basedir %>/diffs/latest.osc ]; then
 
  22       DATA_VERSION=`osmium fileinfo -e -g data.timestamp.last <%= @basedir %>/diffs/latest.osc`
 
  23       if [ "x$DATA_VERSION" != "x" ]; then
 
  24         echo "Downloaded up to timestamp $DATA_VERSION"
 
  25         while ! <%= @basedir %>/bin/update_from_dir --osc-dir=<%= @basedir %>/diffs --version=$DATA_VERSION $META --flush-size=0; do
 
  26           echo "Error while updating. Retry in 1 min."
 
  30       rm <%= @basedir %>/diffs/latest.osc
 
  33     $PYOSMIUM -v -s 1000 -o <%= @basedir %>/diffs/latest.osc
 
  37   if [ $status -eq 0 ]; then
 
  38     echo "Downloaded next batch."
 
  39   elif [ $status -eq 3 ]; then
 
  40     rm <%= @basedir %>/diffs/latest.osc
 
  41     echo "No new data, sleeping for a minute."
 
  44     echo "Fatal error, stopping updates."