简体   繁体   中英

how to make apscheduler forever in linux

  • I want to run apscheduler forever in Linux
  • But. The apscheduler not work when I close the terminal.

here is my code

from apscheduler.schedulers.background import BackgroundScheduler
from datetime import datetime

def tick():
    text = 'Tick! The time is: %s' % datetime.now()
    saveLog(text)

if __name__ == '__main__':
    scheduler = BlockingScheduler()
    scheduler.add_job(tick, 'cron', hour=9)
    scheduler.start()

Run Python In Terminal

python3 my.py &

在Linux中使用Screen可以让您在后台运行应用程序实例,

您正在寻找nohup

nohup my.py &

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM