gibney.org : Technology : Linux : Capture Processes


just a logo :)

search:


See as: raw | code

terms of service | imprint

gibney.org
is powered by m1d1





Capture Processes
(Entry Nr. 339, by user 1 | edit)
Here is an example for php processes:

while :; do ps -eo "%p %x %a"|grep [b]in/php;sleep 0.5; done

Here is a more luxurious version, that prefixes each line with the current time and logs the output to a file:

while sleep 1; do ps -eo "%p %x %a"|awk '/bin\/php/ {system("printf %s\\  $(date +\"%Y-%m-%d_%H:%M:%S\")");print}';done | tee -a processes.txt


In the last one, please be aware that there are 2 whitespaces after "%s\\". The command will fail, if there is only one.
Create a new entry at this position