I am newer to using Linux(Ubuntu) and GOCD. I have installed GOCD Agent and PM2 on LINUX(Ubuntu) VM for a Node JS app and trying to run PM2 restart command from GOCD Agent. But it is giving error -
[go] Task: pm2 restart my-app Use --update-env to update environment variables [PM2][ERROR] Process or Namespace my-app not found [go] Task status: failed, took: 0.181s, exited: 1 [go] Current job status: failed
Firstly I added above task in PM2 using my user but error was same. Then I tried to add above task using PM2 by sudo user. But error is same in both cases.
This issue was because PM2 was running from one user while GOCD has its own user running named 'go'. To solve this issue, I followed below steps -
PM2_HOME = /YOUR_PATH_OF_PM2