I want to prevent multiple python scripts from crashing on my Raspberry Pi (Stretch OS).
I wanted to clarify if this would be the way of implementing a systemd file to prevent multiple python scripts from crashing. Under the service section of the service file, the typical format is:
[Service]
ExecStart=/path/too/script
Restart=always
But since I am running multiple python scripts, I think I should add python to the front of the path, as well as stacking service section on top of each other. Please correct me if I am wrong.
My current script is:
[Unit]
Description='python scripts that needs to be run constantly'
[Service]
ExecStart=python /home/pi/projects/script1.py
Restart=always
[Service]
ExecStart=python /home/pi/projects/script2.py
Restart=always
[Service]
ExecStart=python /home/pi/projects/script3.py
Restart=always
[Install]
WantedBy=multi-user.target
Is the above code the right way to do it? Also, do I need to add a path to my python library? i.e.PYTHONPATH=/home/pi/.local/lib/python2.7/site-packages
I am really new to the linux environment, and would appreciate any advice on this!