Does pm2 auto restart application after reboot by default?


I have an issue with my linux server and need to reboot, before that I run my node application with pm2 start server.js without any other config. Can it auto restart my app after reboot server?


Not by default, but PM2 can do so using a startup script:

PM2 can generate startup scripts and configure them in order to keep
your process list intact across expected or unexpected machine

After generating your startup script (read also this comment), take a look at pm2 save:

Once you started all the applications you want to manage, you have to
save the list you wanna respawn at machine reboot with:

pm2 save

Answered By – pzaenger

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published