Skip to content

Service file for systemd #1651

Closed
Closed
@borpin

Description

I think a useful addition would be a service file for rtl_433

# Do not edit this file - make changes required via a dropin.
#
# First create a symbolic link from the install folder to the systemd folder
#
# sudo ln -sf /home/pi/rtl_433/rtl_433.service /lib/systemd/system
#
# register the Service file
# sudo systemctl daemon-reload
#
#
# Second, create you own set of runtime commands using the systemctl edit mechanism to create a dropin file.
# You can replace any of the commands in the standard service file by adding them to the dropin.
# as a minimum you will want to edit the RTL_433_OPTIONs environment varialbe with the command line options you want
#
# sudo systemctl edit rtl_433.service
#
# Example contents of the dropin (remember it needs the sections in [])
#
# [Service]
# Environment='RTL_433_OPTIONS= -vv -M time:unix -M level -R 03 -R 32 -F "mqtt://<IP>:1883,user=xyz,pass=xyz,retain=0, events=rtl2[/model]"'
#
# Once the dropin in done, do a daemon-reload again
# sudo systemctl daemon-reload
#
# Start the service - check the syslog or the service status to see if OK.
# sudo systemctl start rtl_433.service
#
# To start the service at boot, enable it
# sudo systemctl enable rtl_433.service

[Unit]
Description=RTL_433 service script
StartLimitIntervalSec=5
Documentation=https://github.com/merbanan/rtl_433/README.md

[Service]
Type=exec
# Include a user via the Dropin if required
#User=pi

Environment='RTL_433_OPTIONS= -vv'

ExecStart=/usr/local/bin/rtl_433 $RTL_433_OPTIONS

# 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

# modify via a dropin to use a dedicated log file for StdOut and StdErr.
# 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

StandardOutput=syslog
StandardError=syslog

[Install]
WantedBy=multi-user.target

YMMV

Metadata

Assignees

No one assigned

    Labels

    documentationissue contains information that should be captured in docsenhancementRequest to add a feature (other than a decoder)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions