View all PHP scripts running via SSH in real time

Asked

Viewed 180 times

4

I have some scripts that do a data Mining job, and in some cases need to run long processes that can consume a lot of CPU. I need to find a command via SSH to monitor all running PHP scripts. Something like:

watch ps -F -C php-cgi ... 

but it doesn’t work for me.

  • 1

    It depends on many factors. When running under a webserver, Apache, for example, will display the "httpd" process. When you run via CLI, the compiler path is displayed and not the file that was invoked. For more control, look over Signal Handler: http://php.net/manual/en/function.pcntl-signal.php. Only be aware of which functions pcntl use POSIX, so it doesn’t work under Windows environment. See also http://php.net/manualen/event.addsignal.php. No time to post as response. For it requires a relatively long answer.

  • @Eduardo are you running Phps standalone (via shell)? No ps- aux you see the processes separately?

  • Scripts are executed in the background using &? If yes, you can use the command jobs or jobs -l to list commands running in the background.

1 answer

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.