From 2bd9b0ca20ba7f9137ac30de85df9f59f6629b77 Mon Sep 17 00:00:00 2001 From: Kim Huebel Date: Sat, 20 Mar 2021 10:27:16 +0000 Subject: [PATCH] Added systemd-startup-script and short description how to install this --- systemd/README.md | 36 ++++++++++++++++++++++++++++++++++++ systemd/YSFReflector.service | 15 +++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 systemd/README.md create mode 100644 systemd/YSFReflector.service diff --git a/systemd/README.md b/systemd/README.md new file mode 100644 index 0000000..fecfb58 --- /dev/null +++ b/systemd/README.md @@ -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 + diff --git a/systemd/YSFReflector.service b/systemd/YSFReflector.service new file mode 100644 index 0000000..a0e3454 --- /dev/null +++ b/systemd/YSFReflector.service @@ -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