Question:
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?
Answer:
You have Configure the nodejs cron job for parse-server job schedule.
- install “CRON” module – npm install cron,(reference:https://www.npmjs.com/package/cron).
- Change the parse server job Schedule function declaration.
Parse.Cloud.job("jobScheduleName", function(){ })
to
function jobScheduleName() { };
- Run cron
1 2 3 4 5 6 7 |
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"); |