Closed llioor closed 6 years ago
Can you show me the content of the startup script? (cat /etc/systemd/system/pm2*)
[Unit] Description=PM2 process manager Documentation=https://pm2.keymetrics.io/ After=network.target
[Service] Type=forking User=root LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity Environment=PATH=/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/ Environment=PM2_HOME=/root/.pm2 PIDFile=/root/.pm2/pm2.pid
ExecStart=/usr/lib/node_modules/pm2/bin/pm2 resurrect ExecReload=/usr/lib/node_modules/pm2/bin/pm2 reload all ExecStop=/usr/lib/node_modules/pm2/bin/pm2 kill
[Install] WantedBy=multi-user.target [Unit] Description=PM2 process manager Documentation=https://pm2.keymetrics.io/ After=network.target
[Service] Type=forking User=ubuntu LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity Environment=PATH=/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/ Environment=PM2_HOME=/home/ubuntu/.pm2 PIDFile=/home/ubuntu/.pm2/pm2.pid
ExecStart=/usr/lib/node_modules/pm2/bin/pm2 resurrect ExecReload=/usr/lib/node_modules/pm2/bin/pm2 reload all ExecStop=/usr/lib/node_modules/pm2/bin/pm2 kill
[Install] WantedBy=multi-user.target
Mmm there are two init script here. One for root and one for ubuntu.
If you want to keep only the pm2 running under ubuntu type the following:
sudo pm2 unstartup
I searched for a solution online but it looks like only I have this issue! I installed pm2 on Ubuntu 16.04 I need to run pm2 as ubuntu user but I have 2 installations of pm2:
Even when I remove the folders, remove any memory of pm2 (which pm2)... uninstall node and npm and reinstall it still install pm2 in 2 locations.
This is how I install node: (current user is ubuntu)
This is how I install pm2: (current user is ubuntu)
Then I run
ps -ef | pm2
and I have the same results.