Im planning on making a script on python that monitors some external parameters and act based on the retrieved data. The check basically is do an http call on a server on the network, and if the response it not as expected do another http call on another server on the network.
The script will have a 60 seconds interval on checking, and will keep checking hopefully indefinitely.
Here is a trimmed down version of what i currently have
import time
if __name__ == '__main__':
while True:
runCheckfunction()
time.sleep(60)
Its very straight forward, which makes me doubt, it cant be that simple right?
Concerns:
During sleep i am worried that this script might be using excessive CPU resources, which might be a concern since it will be run on an embedded machine.
Memory leak. Although very unlikely and if it does happen it wont be in the infinite loop part and it would be in the runCheckFunction() due to my bad programming. After the functions exits is it safe to assume that it frees up all memory it used? I dont have global variables and everything is self contained within that function?
Are there better methods for this? like a standard module that i do not know of that is made to handle this exact purpose?