From b4571b0c1e5a904286619e6929bbbe157461b1d4 Mon Sep 17 00:00:00 2001 From: "rtrp@factory1" Date: Wed, 27 Jan 2021 21:59:51 +0000 Subject: [PATCH] create a Systemd service file. This file is used to start the program at startup. It, also, restarts the program if it crashes or throws an exception. The usual scenario which causes the program to crash is the 'max. requests exceeded' exception in the 'requests' module (Python). When that happens, this 'restart' service has a 60 seconds wait period -- which acts as a 'backoff' period. You will need to copy the .service file to the appropriate systemd location, 'daemon-reload' systemctl, enable the service and start the service. You will need to look-up how to do that -- this info. is beyond the scope of this commmit. --- light-meter.service | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 light-meter.service diff --git a/light-meter.service b/light-meter.service new file mode 100644 index 0000000..281b5b7 --- /dev/null +++ b/light-meter.service @@ -0,0 +1,16 @@ +[Unit] +Description=Light-Meter service for Return to Ritherdon project by Nicola Ellis +After=network.service + +[Service] +Type=simple +ExecStart=bash /home/rtrp/repos/light-meter/startup.sh +WorkingDirectory=/home/rtrp/repos/light-meter +StandardOutput=inherit +StandardError=inherit +Restart=always +RestartSec=60 +user=rtrp + +[Install] +WantedBy=multi-user.target