我的本地 crontab 文件中有以下计划:
*/10 * * * * /usr/local/bin/node /Users/harrisoncramer/CrontabScripts/dsca-arms-sales/xmlParser.js
它使用 Node 来运行我的文件的本地副本。我也将这个 Node 项目存储在Digital Ocean上。然而,当我尝试编写一个非常相似的时间表时,我收到以下错误:
"/tmp/crontab.Wf1279/crontab":0: bad minute
errors in crontab file, can't install.
Do you want to retry the same edit?
crontab 文件如下所示:
10/* * * * * nodejs /home/harrisoncramer/dsca_sales_tracker/xmlParser.js
# Edit this file to introduce tasks to be run by cron.
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task....etc.....
Digital Ocean 指定,当您想使用 Node 来运行应用程序时,您应该在 crontab 中引用 Nodejs。 当我简单地使用所有通配符运算符时,该脚本就可以工作。当我尝试将其转换为“每 10 分钟”时,它会崩溃。
我做错了什么?
最佳答案
您的 crontab 语法错误已关闭。运行命令,例如每 10 分钟使用一次
*/10 * * * */path/to/the/command
。
您可以找到有关 crontab 配置的更多信息 here .
关于node.js - Digital Ocean Server中的Crontab调度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52488665/