Search code examples
pm2

How to auto-resurrect pm2 after system restart


I have set up the jobs in pm2 and used command pm2 save. If the server unfortunately crashed and restarted, i had to check and manually run pm2 resurrect to restart all saved jobs.

Is there any solution that whenever server reboots pm2 resurrect is automatically called?


Solution

  • If you are using windows server, you could add a script in task scheduler that runs on boot:

    SET PM2_HOME=D:\PATH\TO\PM2\DIRECTORY
    pm2 resurrect