I wish to schedule a python script for every 30 minutes. I am currently using the Timer to run the python script but it is not working precisely. I am using Linux. This code works fine on windows but is not working correctly on Linux. It should be triggered after half an hour but it gets triggered within a minute.
from datetime import datetime, timedelta
from threading import Timer
j=1
while True :
x=datetime.today()
y = x + timedelta(minutes=10*j)
print(y)
delta_t=y-x
secs=delta_t.seconds + 1
def hello_world():
print ("hello world")
print("yes)")
t = Timer(secs, hello_world)
t.start()
j=j+1`
Can anyone point out the mistake in above code or suggest an alternative to run the python script in linux after every 30 minutes?
Thank you