Update DEVELOPMENT.md

Updated systemd config with recommendations from https://github.com/geoffwhittington/meshtastic-matrix-relay/pull/57#pullrequestreview-1620383106
pull/1/head
noah 2023-09-11 13:30:32 -04:00 zatwierdzone przez GitHub
rodzic fca289d50e
commit 335332f73b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 14 dodań i 7 usunięć

Wyświetl plik

@ -85,19 +85,26 @@ INFO:meshtastic.matrix.relay:Sent inbound radio message to matrix room: #someroo
```
## Persistence
If you'd like the bridge to run automatically on startup in Linux, you can set up a systemd service.
If you'd like the bridge to run automatically (and persistently) on startup in Linux, you can set up a systemd service.
In this example, it is assumed that you have the project a (non-root) user's home directory, and set up the venv according to the above.
Create the file ```~/.config/systemd/user/mmrelay.service```:
```
[Unit]
Description=A Meshtastic to [matrix] bridge
After=multi-user.target
After=default.target
[Service]
Type=idle
WorkingDirectory=/home/$USER/meshtastic-matrix-relay
ExecStart=/home/$USER/meshtastic-matrix-relay/.pyenv/bin/python /home/$USER/meshtastic-matrix-relay/main.py
WorkingDirectory=%h/meshtastic-matrix-relay
ExecStart=%h/meshtastic-matrix-relay/.pyenv/bin/python %h/meshtastic-matrix-relay/main.py
Restart=on-failure
[Install]
WantedBy=multi-user.target
WantedBy=default.target
```
The service is enabled and started by
```
$ systemctl --user enable mmrelay.service
$ systemctl --user start mmrelay.service
```
In this example, it is assumed that you cloned the git repo into a user's home directory, and set up the venv according to the above.