Skip to content

Commit

Permalink
Merge pull request #57 from lingawakad/lingawakad-patch-1
Browse files Browse the repository at this point in the history
Add systemd service example to DEVELOPMENT.md
  • Loading branch information
jeremiah-k committed Sep 11, 2023
2 parents c540eb2 + 335332f commit 52b931e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,28 @@ INFO:meshtastic.matrix.relay:Processing inbound radio message from !613501e4 on
INFO:meshtastic.matrix.relay:Relaying Meshtastic message from Alice to Matrix: [Alice/VeryCoolMeshnet]: Hey Bob!
INFO:meshtastic.matrix.relay:Sent inbound radio message to matrix room: #someroomid:example.matrix.org
```

## Persistence
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=default.target
[Service]
Type=idle
WorkingDirectory=%h/meshtastic-matrix-relay
ExecStart=%h/meshtastic-matrix-relay/.pyenv/bin/python %h/meshtastic-matrix-relay/main.py
Restart=on-failure
[Install]
WantedBy=default.target
```
The service is enabled and started by
```
$ systemctl --user enable mmrelay.service
$ systemctl --user start mmrelay.service
```

0 comments on commit 52b931e

Please sign in to comment.