Hi, I am trying to get 2 Python3 scripts to restart if there's an error or other occurrence. I have a Raspberry Pi running on Debian 24/7 - Buster.
Right now, I have the 2 Python scripts running in the "Screen" program because I didn't want to leave SSH terminals open (I use my Raspberry Pi set-up headless.)
For the most part, the scripts are pretty stable, but I've had them drop off of Screen before and didn't even know it.
I've tried various ways to get this working, including making the 2 Python scripts into services, but I would receive various exit codes and couldn't figure out what the problem was (one had to do with user authorization or something like that.) Both scripts work together. The only solution that gets them to work is either running them in the background with Screen or running them from a terminal window and just leave those windows open.
Also, both scripts do load on on re-boot, as they are listed within Crontab -e.
To recap, the main thing I am trying to do is get them to re-load themselves if they exit or have an error for any reason (getting an email would be great, too.) Very open to going back to making these as a systemd service if I can get some help with that part.
Both scripts are located at /home/pi/
Thank you
Right now, I have the 2 Python scripts running in the "Screen" program because I didn't want to leave SSH terminals open (I use my Raspberry Pi set-up headless.)
For the most part, the scripts are pretty stable, but I've had them drop off of Screen before and didn't even know it.
I've tried various ways to get this working, including making the 2 Python scripts into services, but I would receive various exit codes and couldn't figure out what the problem was (one had to do with user authorization or something like that.) Both scripts work together. The only solution that gets them to work is either running them in the background with Screen or running them from a terminal window and just leave those windows open.
Also, both scripts do load on on re-boot, as they are listed within Crontab -e.
To recap, the main thing I am trying to do is get them to re-load themselves if they exit or have an error for any reason (getting an email would be great, too.) Very open to going back to making these as a systemd service if I can get some help with that part.
Both scripts are located at /home/pi/
Thank you