3 # DO NOT EDIT - This file is being maintained by Chef
5 date "+%c === Starting Nominatim update cycle"
9 <% if node.platform?("debian") -%>
10 EXTRA_PIP='--extra-index-url <%= node[:nominatim][:pip_index] %>'
12 # First update the importer and run the migrations.
13 if <%= @venvprefix %>pip list $EXTRA_PIP --outdated | fgrep -q nominatim-db; then
14 <%= @venvprefix %>pip install $EXTRA_PIP -U nominatim-db
15 if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-refresh-db; then
16 date "+%c === Database refresh failed. Stopping updates."
20 # Then only attempt to update the frontend.
21 if <%= @venvprefix %>pip list $EXTRA_PIP --outdated | fgrep -q nominatim-api; then
22 <%= @venvprefix %>pip install $EXTRA_PIP -U nominatim-api
23 systemctl reload nominatim
26 <% if node[:nominatim][:enable_git_updates] -%>
27 if /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-source; then
29 if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-refresh-db; then
30 date "+%c === Database refresh failed. Stopping updates."
34 pushd <%= @builddir %>
37 systemctl reload nominatim
42 if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-data; then
43 date "+%c === Data update failed. Stopping updates."
47 date "+%c === Nominatim update cycle finished"
49 # sleep a bit if updates take less than a minute
51 elapsed=$((endtime - starttime))
52 if [[ $elapsed -lt 60 ]]; then
53 sleepy=$((60 - $elapsed))
54 date "+%c === Sleeping for ${sleepy}s..."