I only hesitate to share because I know just enough about systemd to be dangerous. One should NOT use these as a template but as additional information to learn from.
The rtl_433 file. There is additional lines because I use
https://pushover.net to monitor things related to WeeWX
# systemd unit configuration file for rtl_433
#
[Unit]
Description=rtl_433 service
Documentation=
https://github.com/merbanan/rtl_433/README.md# StartLimitIntervalSec=5
After=syslog.target network.target
StartLimitIntervalSec=500
StartLimitBurst=5
[Service]
Environment=UUID=replace_me
Restart=on-failure
RestartSec=5s
# Type=exec
#ExecStart=/usr/local/bin/rtl_433 -M utc -F json -F mqtt://localhost:1883,retain=0,devices=rtl_433[/host]/devices[/type][/model][/subtype][/channel][/id]
ExecStart=/usr/local/bin/rtl_433 -M utc -F mqtt://localhost:1883,retain=0,devices=rtl_433[/host]/devices[/type][/model][/subtype][/channel][/id]
## ExecStartPre runs before, the "-" in the beginning is to let systemd continue even on non-zero exit
ExecStartPre=-/bin/bash -c "curl -fsS -m 10 --retry 5 -o /dev/null
https://hc-ping.com/$UUID"
## ExecStopPost runs after, no matter if ExecStart was success or not. The "-" in the beginning is like ExecStartPre
ExecStopPost=-/bin/bash -c "curl -fsS -m 10 --retry 5 -o /dev/null
https://hc-ping.com/$UUID/fail"
# Restart script if stopped
#Restart=always
# Wait 30s before restart
#RestartSec=30s
# Tag things in the log
# View with: sudo journalctl -f -u rtl_433 -o cat
#SyslogIdentifier=rtl_433
# NOTE: only works in systemd v236+
# Debain "stretch" includes v232, "buster" includes v239
# Note also the user must be able to create the file and logrotate must be amended to rote the log.
StandardOutput=file:/var/log/rtl_433.log
StandardError=file:/var/log/rtl_433.log
#StandardOutput=syslog
#StandardOutput=null
#StandardError=syslog
# To run as a non-root user, uncomment and set username and group here:
#User=pi
#Group=pi
[Install]
WantedBy=multi-user.target
My WeeWX file. I hacked this up in 4.x. I would think 5.x would work just fine.
# source bellrichm-configs weewx/multi/systemd
[Unit]
Description=WeeWX gather %i data
Documentation=
https://weewx.com/docsRequires=time-sync.target
After=time-sync.target
RequiresMountsFor=/home
[Service]
ExecStart=/home/weewx/bin/weewxd --log-label=weewx-%i /home/weewx/%i.conf
StandardOutput=null
# To run as a non-root user, uncomment and set username and group here:
User=pi
Group=pi
[Install]
WantedBy=multi-user.target
Yup MQTTSubscribe runs as either driver or service. Nothing special to running as a driver.
rich