crontab 可以考慮設定如下 即可在你要指定的時間去執行你想要的動作*/5 9-13 * * * PYTHON_FILE YOUR_SCRIPT
import schedule
import time
def job(counter):
print(f"{counter['counter']} - I'm working...")
counter['counter'] = counter['counter'] + 1
def startAt():
counter = 0
return schedule.every(5).minutes.until("13:00").do(job, counter={'counter': counter})
schedule.every().day.at("09:00").do(startAt)
while True:
schedule.run_pending()
time.sleep(1)
大概是這樣吧,沒實際測試過就是了