Merge pull request #3 from dg9vh/systemd

Added systemd-startup-script and short description how to install this
This commit is contained in:
Antonio Matraia 2021-03-20 12:06:07 +01:00 committed by GitHub
commit b1ed2436f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 0 deletions

36
systemd/README.md Normal file
View File

@ -0,0 +1,36 @@
# Running the pYSFReflector as a Service
Most of us will run the pYSFReflector as a service to be started automatically at system startup.
A common way to realize this is using startup-scripts. Almost all modern Linux-systems support
systemd-startup-system.
The script you find here in this directory is such a systemd-startup-script.
Simply copy it (as root) into /etc/systemd/system and use the following commands to make it running:
`sudo systemctl enable YSFReflector.service`
and for starting it initially:
`sudo systemctl start YSFReflector.service`
But before you start the reflector with this command keep sure to have following steps done:
a) Add a group named mmdvm to your system-groups with: `sudo groupadd mmdvm`
b) After this add the system-user mmdvm to your users with: `sudo useradd mmdvm -g mmdvm -s /sbin/nologin`
c) make the logdir configured in your YSFReflector.ini owned by mmdvm for example like this:
`sudo chown -R mmdvm:mmdvm /var/log/YSFReflector`
Now all is prepared for starting the reflector automatically.
To control the reflector's functions you could use following commands:
`sudo systemctl start YSFReflector.service` starts the reflector if not running
`sudo systemctl stop YSFReflector.service` stops the reflector
`sudo systemctl restart YSFReflector.service` restarts a running reflector (for example after changeing YSFReflector.ini)
`sudo systemctl status YSFReflector.service` shows actual running state of reflector

View File

@ -0,0 +1,15 @@
[Unit]
Description=YSFReflector
After=network.target
[Service]
ExecStartPre=/bin/sleep 1
Type=simple
User=mmdvm
Group=mmdvm
Restart=always
# Modify for different location of Python3 or location of files
ExecStart=/usr/bin/python3 /usr/local/bin/YSFReflector /etc/YSFReflector/YSFReflector.ini
[Install]
WantedBy=multi-user.target