mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
Merge pull request #2598 from geofabrik/doc-update-systemd-timer
Document how to set up systemd timers for --once updates
This commit is contained in:
@@ -131,6 +131,63 @@ done
|
|||||||
|
|
||||||
A cron job then creates the file `/srv/nominatim/schedule-maintenance` once per night.
|
A cron job then creates the file `/srv/nominatim/schedule-maintenance` once per night.
|
||||||
|
|
||||||
|
##### One-time mode with systemd
|
||||||
|
|
||||||
|
You can run the one-time mode with a systemd timer & service.
|
||||||
|
|
||||||
|
Create a timer description like `/etc/systemd/system/nominatim-updates.timer`:
|
||||||
|
|
||||||
|
```
|
||||||
|
[Unit]
|
||||||
|
Description=Timer to start updates of Nominatim
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnActiveSec=2
|
||||||
|
OnUnitActiveSec=1min
|
||||||
|
Unit=nominatim-updates.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
|
||||||
|
And then a similar service definition: `/etc/systemd/system/nominatim-updates.service`:
|
||||||
|
|
||||||
|
```
|
||||||
|
[Unit]
|
||||||
|
Description=Single updates of Nominatim
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
WorkingDirectory=/srv/nominatim
|
||||||
|
ExecStart=nominatim replication --once
|
||||||
|
StandardOutput=append:/var/log/nominatim-updates.log
|
||||||
|
StandardError=append:/var/log/nominatim-updates.error.log
|
||||||
|
User=nominatim
|
||||||
|
Group=nominatim
|
||||||
|
Type=simple
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace the `WorkingDirectory` with your project directory. Also adapt user and
|
||||||
|
group names as required. `OnUnitActiveSec` defines how often the individual
|
||||||
|
update command is run.
|
||||||
|
|
||||||
|
Now activate the service and start the updates:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable nominatim-updates.timer
|
||||||
|
sudo systemctl start nominatim-updates.timer
|
||||||
|
```
|
||||||
|
|
||||||
|
You can stop future data updates, while allowing any current, in-progress
|
||||||
|
update steps to finish, by running `sudo systemctl stop
|
||||||
|
nominatim-updates.timer` and waiting until `nominatim-updates.service` isn't
|
||||||
|
running (`sudo systemctl is-active nominatim-updates.service`). Current output
|
||||||
|
from the update can be seen like above (`systemctl status
|
||||||
|
nominatim-updates.service`).
|
||||||
|
|
||||||
|
|
||||||
#### Catch-up mode
|
#### Catch-up mode
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user