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