I want to build a control panel for all the pm2 in Admin Dashboard and let admin have control to start/stop/restart/delete the running processes. How can i get the list of running pm2 queue in laravel.
Asked
Active
Viewed 656 times
1 Answers
0
You can use exec function
$processList=null;
exec('pm2 list',$processList)
But you must run PHP with the same user as pm2. If you want to use different user check Running command-line application from PHP as specific user

Muhammad Dyas Yaskur
- 6,914
- 10
- 48
- 73
-
currently my user on pm2 show "laradock" and whereas if i run "whoami" in laravel then it shows "www-data". Can you help how to config for this? @muhammad – Amar Ratna Shakya Jan 06 '22 at 05:02
-
I already linked answer to solving that problem. https://stackoverflow.com/questions/6913403/running-command-line-application-from-php-as-specific-user – Muhammad Dyas Yaskur Jan 06 '22 at 05:45
-
Yes thank you but the problem is i'm using laradock and i don't see any sudoers to update the config @muhammad – Amar Ratna Shakya Jan 06 '22 at 05:50