Search code examples
pm2

How can I completely stop a pm2 managed application?


Say I have a pm2 process that runs every 5 minutes and takes less than a second to run:

pm2 start ./some-node-script.js --name some-node-script --cron "*/5 * * * *" --no-autorestart

Now say I want to completely stop execution of the job. If I issue pm2 stop some-node-script, I get this warning:

[PM2][WARN] App some-node-script stopped but CRON RESTART is still UP */5 * * * *

And then the job executes again on the next 5 minute interval. Is there a way I can stop the cron job from executing again? I've tried pm2 kill, but that kills every job being managed by pm2.


Solution

  • use

    $ pm2 delete [id]
    

    you can retrieve the [id] using

    $ pm2 ps