python - 如何让 apscheduler 永远在 linux 中运行

标签 python linux apscheduler

  • 我想在 Linux 中永远运行 apscheduler
  • 但是。当我关闭终端时,apscheduler 不工作。

这是我的代码

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 &

最佳答案

使用 Screen在 Linux 中将允许您在后台运行应用程序实例,

关于python - 如何让 apscheduler 永远在 linux 中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40503569/

相关文章:

linux - 在 Linux 上用 g++ 编译 RInside 程序

linux - 根据列查找重复行并使用 awk 打印两行及其编号

python-3.x - python apschedular RedisJobStore 不在 redis 缓存中存储作业

python - 使用 pyramid_mailer 和 apscheduler 发送预定的电子邮件

python - 如何在python中实现负二项式损失函数以用于轻型GBM?

python - 在Python中从txt文件中读取列表

python - mysql.connector 和常规 MySQL 中的精确查询不返回相同的结果

python - pandas value_counts 输出文件

linux - Linux上的.net Core独立服务器

python - 在 Gunicorn 中运行 ApScheduler 而无需为每个 Worker 复制