I want to make a cron job to send mail every 15 minutes taking data from a database table. In node js I can make a cron job but through PM2 I don\'t understand where to plac
If you use PM2 ecosystem then in the config file add cron sequence to script param by wrapping it with single quotes. Somehow double quotes didn't work for me.
module.exports = {
apps : [{
name : "Send-mail",
script : "./sendMail.js --cron '*/15 * * * *'",
watch : true
}]
}
alternatively (my preference)
module.exports = {
apps : [{
name : "Send-mail",
script : "./sendMail.js",
cron_restart: "*/15 * * * *",
watch : true
}]
}