How to use pm2 launch command on Debian platform?

Here is the link to the GitHub documentation: https://github.com/Unitech/pm2#startup-script-generation--pm2-startup

This is the setting for working with Ubuntu / CentOS / Redhat. I need it to work with my Dreamhost VPS, which is a Debian machine.

Can someone advise me how can I configure the init script to work in a Debian window? Thanks!!

+1
source share
4 answers

Try the ubuntu solution. Since ubuntu is a debian fork, it should work there.

+3
source

If your vps launches the Jessie release (> 8), then Jessie uses systemd not init.d (like Ubuntu and older versions of debian do). Thus, using the default ubuntu pm2 startup script will not work.

So, if this is your case, then all I did for this to work on my Jessie VM was

$ pm2 startup systemd 

then pm2 run the node applications that I want to run on boot.

then

 $ pm2 save 

then try.

 $ shutdown -r now 

of course do it from root

more details here. http://pm2.keymetrics.io/docs/usage/startup/

+8
source

as the conclusion suggests, you should execute it as sudo:

 sudo pm2 startup ubuntu 
+4
source

You can simply add a cronjob, like:

 @reboot cd /path/to/app && pm2 start app.js 

Remember to install cron in the user who will run the daemon, NOT CORT .

If you cannot install cron, just install cron where you prefer, and add the -u option to specify the user of the running daemon.

+3
source

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


All Articles