I have created a systemd service which runs a python script just after boot. I am having a problem that the python script is running a second time when the pi starts shutting down. Pi Model3A+ running the most recent version of Buster. I am using the python code to calculate dusk and dawn times so that the project is only on when it is dark (between sunset and sunrise - I am using a mopi to trigger shutdown/ boot times).
My systemd file looks like this -
Code: Select all
[Unit] Description=astralatstart After=time-sync.target [Service] ExecStart=/usr/bin/python3 -u astralcalc.py WorkingDirectory=/home/pi/Desktop StandardOutput=append:/home/pi/Desktop/xastralcalc.log StandardError=inherit Restart=no [Install] WantedBy=multi-user.target
Is there a reason that the script is re-running on shutdown and is there a way for me to add an additional dependency in the systemd service file so that my python script only runs at startup?