【问题标题】:Failed to run schedule job via Crontab in Python Macbook air无法通过 Python Macbook air 中的 Crontab 运行计划作业
【发布时间】:2020-06-26 06:30:22
【问题描述】:

我尝试安排我的 Python 脚本每天通过 cron 运行,但失败了,请问我的 MacBook 出现了什么错误?

  1. 在终端输入 crontab -e
  2. 将以下代码复制到 crontab

    38 22 * * 0-6 $(which python3) /Users/mrcheung/Desktop/Python/Stock_Monitoring/Stock_monitoring_students_v6_lesson_2020.py
    
  3. 保存作业以输入 :wq

但是,我等不及作业正在运行,是否有任何缺少的步骤或语法错误?

0 22 * * 0-6 /Users/mrcheung/Desktop/Python/Stock_Monitoring/Stock_monitoring_students_v6_lesson_2020.py
You have mail in /var/mail/mrcheung
bash-3.2$ crontab -e
crontab: installing new crontab
bash-3.2$

【问题讨论】:

  • 欢迎来到 SO。请在此处查看How to ask a good question
  • 谢谢,但我可以知道这个问题已经被删除了吗?
  • 它没有被删除。您的问题的问题很明确:我们需要当前的、预期的输出以及可能的任何错误跟踪。
  • 所以任何人都可以帮助我解决问题?
  • 这个However, I can't wait the job is running, is there any missing step or syntax error?是什么意思。不是每天(星期日除外)22 小时执行吗?

标签: python cron scheduled-tasks


【解决方案1】:
38 22 * * 0-6 cd /Users/mrcheung/Desktop/Python/Stock_Monitoring/ && python3 /Users/mrcheung/Desktop/Python/Stock_Monitoring/Stock_monitoring_students_v6_lesson_2020.py

【讨论】:

    猜你喜欢
    • 2018-07-05
    • 2021-05-10
    • 2018-06-14
    • 2014-04-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多