问题描述
我花了一整天试图让某种调度程序与我的解析服务器(在 AWS Beanstalk Node.js 上运行)一起工作我能够在 js 文件中获取一些代码,但它似乎不起作用.有什么办法可以设置某种调度程序,这样我就不必通过仪表板手动运行我的作业?
I have spent an entire day trying to get some kind of scheduler working with my Parse Server (running on AWS Beanstalk Node.js)I was able to get some code inside the js file but it did not seem like it was working.Is there any way I can set up some kind of scheduler so I don't have to manually run my jobs through the Dashboard?
推荐答案
您已为解析服务器作业计划配置 nodejs cron 作业.
You have Configure the nodejs cron job for parse-server job schedule.
安装CRON"模块 - npm install cron,(参考:https://www.npmjs.com/package/cron).
更改解析服务器作业调度函数声明.Parse.Cloud.job("jobScheduleName", function(){ })
到function jobScheduleName() { };
Change the parse server job Schedule function declaration. Parse.Cloud.job("jobScheduleName", function(){ })
tofunction jobScheduleName() { };
运行定时任务
var CronJob = require('cron').CronJob; //include dependency
//add this code to run job every 15 minute.
//set your time as per your run schedule.
new CronJob('0 */15 * * * *', function() {
Cron.jobScheduleName();
}, null, true,"timeZone");
这篇关于解析服务器 - 如何使用调度程序一遍又一遍地运行“作业"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!