Matomo Analytics

By default, the PM2 service will not start the services that you are running on boot. This requires an additional step, luckily this step is very easy.

First, run every service you want with PM2 so you're sure all the services you want to be started up on reboot, are started.

Next, run the following command:

pm2 startup

This will give the output like following:

[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u ploi --hp /home/ploi

Next, run that sudo command in your terminal (this will ask for your sudo password):

sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u ploi --hp /home/ploi

After this, PM2's services that have been spawned will be started again upon reboot.

01 February 2022 (last updated 2 years ago)

5809 views

Written by Dennis

Dennis brings over 6 years of hands-on experience in server management, specializing in optimizing web services for scalability and security.

Back to Server


Start free trial