I have a python script that imports GPIO, json, smtplib, requests and threading.
The script POSTs JSON to an API, sends alerts via smtp server and logs data to a TXT file.
Program runs OK from terminal. I am trying to create a systemd unit to start on boot. I keep getting this error in my log file:
Connection Aborted, OSError(101, Network is unreachable)
Here is the file in /lib/systemd/system:
[Unit] Description=My Service Wants=basic.target local-fs.target network-online.target network.target After=basic.target local-fs.target network-online.target network.target [Service] Type=idle ExecStart=/usr/bin/python3 /home/pi/MyScripts/StartUps/MyStartUp.py [Install] WantedBy=basic.target local-fs.target network-online.target network.target
The file is the result of my trying different things attempting to solve the problem. I don't completely understand all the parts.
It appears the service I created is starting before the network service. I would like my service to start after everything else has started on the Pi.