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" -%>
16 status=3 # make it sleep on issues
18 if [ -f <%= @basedir %>/db/replicate-id ]; then
19 # first apply any pending updates
20 if [ -f <%= @basedir %>/diffs/latest.osc ]; then
21 DATA_VERSION=`osmium fileinfo -e -g data.timestamp.last <%= @basedir %>/diffs/latest.osc`
22 if [ "x$DATA_VERSION" != "x" ]; then
23 echo "Downloaded up to timestamp $DATA_VERSION"
24 while ! <%= @basedir %>/bin/update_from_dir --osc-dir=<%= @basedir %>/diffs --version=$DATA_VERSION $META --flush-size=0; do
25 echo "Error while updating. Retry in 1 min."
29 rm <%= @basedir %>/diffs/latest.osc
32 $PYOSMIUM -v -s 1000 -o <%= @basedir %>/diffs/latest.osc
36 if [ $status -eq 0 ]; then
37 echo "Downloaded next batch."
38 elif [ $status -eq 3 ]; then
39 rm <%= @basedir %>/diffs/latest.osc
40 echo "No new data, sleeping for a minute."
43 echo "Fatal error, stopping updates."