PM2 resurrect does not work on reboot - dump.pm2 is empty

I am trying to configure PM2 to demonstrate a simple node.js server on centos. The init.d script is executed and there are no errors, but the pm2 list returns an empty list and the server does not start.

I initially tried to start the process as a different user (for those interested, this can be done with changes to pm2-init.sh ). But because of the complexity, I decided to first try to run it as root.

A strange symptom of the problem is that the dump.pm2 file is dump.pm2 emptied by some process, so the resurrection of pm2 has nothing to do. I set pm2 to start on reboot as follows

 $ pm2 startup centos $ pm2 start /path/to/my/server.js $ pm2 save 

At this point, dump.pm2 had a large JSON object and the server was running. Then do:

 $ reboot ... wait and log back in $ pm2 list 

It was empty again, as well as a .pm2 dump!

I am not sure which process is cleaning this file. I tried reinstalling and restarting the script launch to no avail. Any help is appreciated.

+6
source share
1 answer

As a temporary workaround, I set the dump file as immutable:

 $ chattr +i /path/to/my/dump.pm2 

It worked. Although not ideal, this is what I will use until I can determine why dump.pm2 is being uploaded.

+4
source

Source: https://habr.com/ru/post/985187/


All Articles