just a logo :)



Capture Processes
Entry Nr. 339, by user 1
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.