PM2 Starup (2019.6, using the Node.js APP)

When I try to do a pm2 Startup, I receive the message below. Can you help I have also try with the root user, even worst. _____________________________________________________________________________ admin@axcf2152:~$ pm2 startup [PM2] Init System found: upstart [PM2] To setup the Startup Script, copy/paste the following command: sudo env PATH=$PATH:/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-armv7l/bin /opt/plcnext/appshome/data/60002172000051/lib/node_modules/pm2/bin/pm2 startup upstart -u admin --hp /opt/plcnext/ admin@axcf2152:~$ sudo env PATH=$PATH:/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-armv7l/bin /opt/plcnext/appshome/data/60002172000051/lib/node_modules/pm2/bin/pm2 startup upstart -u admin --hp /opt/plcnext/ Password: Sorry, user admin is not allowed to execute ‘/usr/bin/env PATH=/opt/plcnext/appshome/data/60002172000051/bin:/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-armv7l/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/plcnext/appshome/bin:/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-armv7l/bin /opt/plcnext/appshome/data/60002172000051/lib/node_modules/pm2/bin/pm2 startup upstart -u admin --hp /opt/plcnext/’ as root on axcf2152. ___________________________________________________ thanks

Hey,

what happens if you simply leave out the sudo? or you might have to add env command to sudo list…
What do you mean its even worse as root?

Hi Oliver Thanks for the help with no sudo, same result: admin@axcf2152:~$ env PATH=$PATH:/opt/plcnext/apps/60002172000051/opt/node-v10.1 5.3-linux-armv7l/bin /opt/plcnext/appshome/data/60002172000051/lib/node_modules/ pm2/bin/pm2 startup upstart -u admin --hp /opt/plcnext/

[PM2] Init System found: upstart
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-arm v7l/bin pm2 startup upstart -u admin --hp /opt/plcnext/ When I log has a root user and try it: **root@axcf2152:~# **env PATH=$PATH:/opt/plcnext/apps/60002172000051/opt/node-v10.15.3-linux-armv7l/bin pm2 startup upstart -u admin --hp /opt/plcnext/
env: ‘pm2’: No such file or directory Is it better to try with with a script creation? https://gist.github.com/SidMarc/11ed42b26da7b89c715da72746896240

Hey ,

so it is not the same as before.
it is working. → Admin and without sudo the command works fine from Console? or is there more output?

the problem with root is that it does not have pm2 added to the path…
You added pm2 to the path of the admin user or your active admin shell.
When switching users you will have to redo that path setting.

Yes I guess using init Script with updateRC and start-stop-daemon is a clean solution.
Make sure to use a User in the init Script that has access to pm2 ect. (admin user should be fine i guess)

Start-Stop-Daemon -u admin -g plcnext or something like that…

thanks for the reply Oliver But I am no sure how to do the update-rc.d command, my script file is under init.d with the right write, the name of the file is start_nodered?

I was able to create files using the command update-rc.d start_nodered defaults under a root user, a file call k20start_nodered was created under all the rcx.d folder (with different name S20…etc) but Node-red does not start automatically, what did I forgot?

Hello,

I have no idea.
Is start_nodered executable? As this question is about the OS (Linux) and the update-rc sercvice and the software you are using is NodeRed.
You will properbly be better of browsing through update-rc documentation and Node Red forums…

There has to be a log file somewhere (maybe you can activate it in the start_nodred file).
Otherwise at /var/log/boot you should see messages you add to the start_nodered file