How to make a cron job with PM2

后端 未结 6 1110
隐瞒了意图╮
隐瞒了意图╮ 2020-12-23 14:25

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

6条回答
  •  情歌与酒
    2020-12-23 14:41

    Use the --cron option:

    -c --cron

    For example:

    pm2 start sendMail.js --cron "*/15 * * * *"

    Pm2 will now restart the sendMail.js script on the hour, and at 15, 30 and 45 minutes past the hour

提交回复
热议问题