SoFunction
Updated on 2024-12-10

ubuntu system using pm2 set nodejs boot self-start method

1. Install pm2 : npm install pm2 -gd

At this point, executing the pm2 command at the command line may not be found, and you need to execute the following command

1. Create a soft link: ln -s /home/XXX/node-node-v6.11.5-linux-x64/bin/pm2 /usr/local/bin/pm2

2. The following commands need to be executed under the root user:

sudo pm2 start ./bin/www
sudo pm2 save
sudo pm2 startup
sudo pm2 save

3. Reboot the system to try: if not, execute the

chattr +i /home/XXX/.pm2/dump.pm2 retry again

If it still doesn't work, please check if your database doesn't have a bootloader.

Above this ubuntu system using pm2 set nodejs boot self-start method is all I share with you, I hope to give you a reference, and I hope you support me more.