Skip to content

Commit cb8505a

Browse files
committed
docs: add systemctl configuration setup for rpi
1 parent de2769e commit cb8505a

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,53 @@ rejects `kind=rpicam` profiles at startup with a clear error message.
9494
Third-party software notice for the Raspberry Pi channel: see
9595
[`NOTICE`](NOTICE).
9696

97+
#### Run as a systemd service
98+
99+
After `install.sh` has placed the binary at `/usr/local/bin/onvif-simulator`
100+
and you have copied the rpi example config into place (see
101+
[Configuration](#onvif-simulatorjson)), register the simulator as a system
102+
service so it starts at boot and restarts on failure.
103+
104+
Create `/etc/systemd/system/onvif-simulator.service`:
105+
106+
```ini
107+
[Unit]
108+
Description=ONVIF Simulator
109+
After=network-online.target
110+
Wants=network-online.target
111+
112+
[Service]
113+
Type=simple
114+
User=pi
115+
ExecStart=/usr/local/bin/onvif-simulator start
116+
Restart=on-failure
117+
RestartSec=3
118+
119+
[Install]
120+
WantedBy=multi-user.target
121+
```
122+
123+
Then enable and start it:
124+
125+
```bash
126+
sudo systemctl daemon-reload
127+
sudo systemctl enable --now onvif-simulator.service
128+
systemctl status onvif-simulator.service
129+
journalctl -u onvif-simulator.service -f # tail logs
130+
```
131+
132+
Notes:
133+
134+
- Replace `User=pi` with the account that owns the config file. The user
135+
must be in the `video` group for `kind=rpicam` profiles to access the
136+
camera (the default `pi` account on Raspberry Pi OS already is).
137+
- The simulator reads `onvif-simulator.json` from that user's XDG config
138+
directory (`~/.config/onvif-simulator/onvif-simulator.json` on Linux).
139+
To pin a different path, change `ExecStart` to
140+
`/usr/local/bin/onvif-simulator start -config /etc/onvif-simulator.json`.
141+
- To apply config changes, edit the JSON and run
142+
`sudo systemctl restart onvif-simulator.service`.
143+
97144
## Usage
98145

99146
### CLI Mode

0 commit comments

Comments
 (0)