【问题标题】:Crontab Scheduling In Digital Ocean ServerDigital Ocean 服务器中的 Crontab 调度
【发布时间】:2019-02-28 12:23:19
【问题描述】:

我的本​​地 crontab 文件中有以下时间表:

*/10 * * * * /usr/local/bin/node /Users/harrisoncramer/CrontabScripts/dsca-arms-sales/xmlParser.js

它使用节点来运行我的文件的本地副本。我还将这个节点项目存储在 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 分钟”时,它会中断。

我做错了什么?

【问题讨论】:

  • */1010/* 不同。
  • 哇。太简单了,对不起!

标签: node.js server cron scheduled-tasks digital-ocean


【解决方案1】:

您的 crontab 语法错误已关闭。运行命令,例如每 10 分钟使用一次
*/10 * * * * /path/to/the/command

您可以找到有关 crontab 配置的更多信息here

【讨论】:

    猜你喜欢
    • 2017-02-25
    • 2015-03-13
    • 1970-01-01
    • 2020-03-25
    • 2018-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多