Skip to content

Instantly share code, notes, and snippets.

@nenodias
Created April 18, 2017 13:20
Show Gist options
  • Select an option

  • Save nenodias/ca4e4e51d16caa46f6bea59ffd02108d to your computer and use it in GitHub Desktop.

Select an option

Save nenodias/ca4e4e51d16caa46f6bea59ffd02108d to your computer and use it in GitHub Desktop.
Agendando tarefa com Python
"""Teste."""
import sys
import schedule
import threading
import time
def job():
print("I'm working...")
schedule.every(10).minutes.do(job)
schedule.every().hour.do(job)
schedule.every().day.at("10:18").do(job)
schedule.every().monday.do(job)
schedule.every().wednesday.at("13:15").do(job)
def run():
while True:
schedule.run_pending()
time.sleep(1)
try:
t = threading.Thread(target=run, args=())
t.start()
except:
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment