Im currently running a python script inside a Screen session through this script in rc.local:
screen -L -dmS pi python /home/pi/truck/main2.py &
But I would like it to run through systemd so I can restart it if the Python script crashes.
I tried creating a service in /systemd/system/myscript.service
[Unit]
Description=myscript
After=network.target
[Service]
Type=simple
Restart=on-failure
RestartSec=3
ExecStart=/usr/bin/screen -L -dmS pi python /home/pi/truck/main2.py
[Install]
WantedBy=multi-user.target
But it wont run my script inside the Screen session?
If I get a list of running screens it shows that the screen session "pi" is dead.