I am using the python schedule module. I have a function that I am trying to run at a specfic time. When I try to run it on my local machine it runs at the specified time, however on an ubuntu server it doesn't. When I try to run the task every 5 seconds it works on an ubuntu server so I'm confused on the problem.
Just to note. When I tried testing this an an ubuntu server I changed the time to a couple of minutes ahead of the current time and then started the bot, I'm not sure if this could be the problem.
import schedule
import time
def job():
print('hello')
if __name__ == "__main__":
schedule.every(10).seconds.do(job) // this works
schedule.every().day.at("08:00").do(job)
while 1:
schedule.run_pending()
time.sleep(1)
As Stradivari said, the problem was that the server time wasn't the same as my local machine time.
I fixed it by following this guide: https://www.digitalocean.com/community/tutorials/how-to-set-up-time-synchronization-on-ubuntu-18-04