node.js - Digital Ocean Server中的Crontab调度

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

我的本​​地 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/

相关文章:

ios - 实现iOS自动续订订阅服务器

android - 在 Android 中运行 NodeJs 服务器

perl - 由cron仅运行一个Perl脚本实例

linux - 我可以在 mysqldump cronjob 中使用波浪号 (~) 吗? Linux Cron 未运行

javascript - node/express - 缺少 ) 在参数列表之后

node.js - Auth0 - 范围不足

node.js - 错误: Cannot find module 'gulp-serve'

javascript - 从 WebStorm 运行 Jasmine 测试

python - 无法在 Linux 的虚拟环境中使用包

php - 如何使用 Cron 和 Codeigniter/PHP 查询 MySQL 数据库?