I have a script(RelayControlMainGH.py) that monitors temperature sensors and controls relays. It uses a while true statement with a time.sleep() and runs forever. I also created a script(GetTableTimes.py) that reads 3 database table files and when they get modified a script(CreateRelayControlConfig.py) re-creates the script(RelayControlMainGH.py). So anytime I change those 3 tables in my database this new config file needs to be made because of the path changes or temp changes or logic used on the relays.
What would be a good way to stop the script(RelayControlMainGH.py) from running and allow some time for the new script to be re-created and start it up again.
I tried using cron without the while loop but the script (RelayControlMainGH.py) will not run. I am sure if I put it in cron with the while loop I will have to find it in the system to start and stop it.
What would be the best way to do this?
I am using a raspberry pi with rasbian
What I did was to create a demean service for my script(RelayControlMainGH.py) and start it upon bootup or it can be started anytime. Then in my script that creates the config file I added a stop and start of the demean so it can get the new config file and keep going. It works great!!
start stop python script that gets created dynamically