Convert daemon to a system-wide systemd service
This commit is contained in:
@@ -11,7 +11,7 @@ Designed for a server kept behind glass, but works for any use where you want sy
|
||||
| `asrock_hid.py` | Low level HID driver for the Polychrome controller |
|
||||
| `asrock-led.py` | Manual CLI for raw read/write/commit against the device |
|
||||
| `asrock-indicator.py` | Daemon with socket API plus the `ctl` client |
|
||||
| `asrock-led.service` | systemd user unit for the daemon |
|
||||
| `asrock-led.service` | systemd unit for the daemon (system-wide, installed to `/etc/systemd/system`) |
|
||||
| `99-asrock-led.rules` | udev rule giving the `plugdev` group access to the hidraw node |
|
||||
|
||||
## Requirements
|
||||
@@ -33,20 +33,15 @@ sudo udevadm trigger
|
||||
|
||||
Your user must be a member of the `plugdev` group.
|
||||
|
||||
2. Copy the service unit and start it:
|
||||
2. Install the systemd unit and start it:
|
||||
|
||||
```
|
||||
mkdir -p ~/.config/systemd/user
|
||||
cp asrock-led.service ~/.config/systemd/user/
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now asrock-led.service
|
||||
sudo cp asrock-led.service /etc/systemd/system/asrock-led.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now asrock-led.service
|
||||
```
|
||||
|
||||
Optionally enable linger so the daemon starts at boot even before login:
|
||||
|
||||
```
|
||||
sudo loginctl enable-linger $USER
|
||||
```
|
||||
The daemon runs as root. If you prefer it to run unprivileged, add `User=` and `Group=` under the `[Service]` section (your user must then be in the `plugdev` group for the udev rule above to apply).
|
||||
|
||||
3. Put `asrock-indicator` (client shim) somewhere on your PATH, pointing at the daemon:
|
||||
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
[Unit]
|
||||
Description=ASRock Polychrome system indicator daemon
|
||||
After=default.target
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/python3 /home/owen/asrock-indicator.py daemon
|
||||
ExecStart=/usr/bin/python3 /home/owen/asrock-led-server/asrock-indicator.py daemon
|
||||
Restart=always
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user