![]() graphical-session.target is a target that is only available on the user-bus and is only raised when the user is logged into a graphical session. Add PartOf=graphical-session.target to stop the service when the user logs out of the session. Then change the section to WantedBy=graphical-session.target. This also means you don't need to define DISPLAY, XAUTHORITY, or User= as those are implicit. Your Restart=always and Restart=10s ensure that it tries to launch every 10s, and it does! But somehow your main process is exiting and the Restart= is triggered continuously. However pi is not logged in yet and so it fails to start the first time. Your machine boots up, the display server starts, and your service is activated. Not with and not without the '&' at the end. I have also tried using crontab, but then nothing happened on reboot. I just have it this way currently, so it is easier to check if the program is working as intended. The program does not necessarily need to run in Desktop auto-login so if there is a possible fix in the console version that is fine as well. Or change it to Restart=on-failure, nothing happens when the Raspberry Pi boots up. WorkingDirectory=/home/pi/facial_recognitionĮnvironment=XAUTHORITY=/home/pi/.XauthorityĮnvironment="prog_path"=/home/pi/facial_recognitionĮxecStart=/usr/bin/python /home/pi/facial_recognition/run_on_start.pyīut if I remove this part: Restart=always ![]() When I use the following service file, it does launch but it relaunches every 10 seconds causing the program to be launched infinitely many times. ![]() But I am struggling with getting the program to launch properly. Currently I am trying to run a python script at the Pi's boot up. For context, I am using Raspberry Pi model 3B+.
0 Comments
Leave a Reply. |