Crontab 定时任务不按预计运行怎么办: Revision history

Diff selection: Mark the radio buttons of the revisions to compare and hit enter or the button at the bottom.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.

29 September 2025

  • curprev 10:3710:37, 29 September 2025Mwroot talk contribs 783 bytes +783 Created page with "有一个 crontab 定时任务,设定了半个月了,今天一检查发现它压根儿没运行。 原任务: <syntaxhighlight lang="bash"> 20 6 * * * source /path/to/activate && /path/to/python /path/to/old.py && deactivate </syntaxhighlight> 网上检索,发现应该是 crontab 中的 py 脚本,找不到预设的 bash 环境变量,具体怎么解决我也不想深究。把运行 old.py 的以下环境变量,都写进以下 new.sh,新任务用 sh 脚..."