3 # DO NOT EDIT - This file is being maintained by Chef
5 date "+%c === Starting Nominatim update cycle"
9 <% if node.platform?("debian") -%>
10 # First update the importer and run the migrations.
11 if <%= @venvprefix %>pip list --outdated | fgrep -q nominatim-db; then
12 <%= @venvprefix %>pip install -U nominatim-db
13 if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-refresh-db; then
14 date "+%c === Database refresh failed. Stopping updates."
18 # Then only attempt to update the frontend.
19 if <%= @venvprefix %>pip list --outdated | fgrep -q nominatim-api; then
20 <%= @venvprefix %>pip install -U nominatim-api
21 systemctl reload nominatim
24 <% if node[:nominatim][:enable_git_updates] -%>
25 if /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-source; then
27 if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-refresh-db; then
28 date "+%c === Database refresh failed. Stopping updates."
32 pushd <%= @builddir %>
35 systemctl reload nominatim
40 if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-data; then
41 date "+%c === Data update failed. Stopping updates."
45 date "+%c === Nominatim update cycle finished"
47 # sleep a bit if updates take less than a minute
49 elapsed=$((endtime - starttime))
50 if [[ $elapsed -lt 60 ]]; then
51 sleepy=$((60 - $elapsed))
52 date "+%c === Sleeping for ${sleepy}s..."