I have a daemon that must be run as root on startup.
I use pm2 to start other apps but can not figure out if it can start an app as root. Can it be done?
If not,
I had problems with sudo pm2 start api, but this was since pm2 was already running without sudo privileges, therefor you need to run:
sudo pm2 start api
pm2 kill sudo pm2 start api
This kills the pm2 deamon first, so that it starts in sudo, but then you need sudo for ALL pm2 commands afterwards, like: sudo pm2 ls
sudo pm2 ls