Detalle de todos los procesos que esta ejecutando un usuario en el servidor.

Detalle de todos los procesos que está ejecutando un usuario en el servidor.

Primero se define la función psuser()

psuser(){ command ps -Hcl -F S f -u ${1:-$USER}; }

Una vez creada la función utilizar:

# psuser apache
F S UID      PID  PPID CLS PRI ADDR SZ WCHAN    RSS PSR STIME TTY TIME CMD
5 S apache 16208 12064 TS   21 -  8616 semtim  8752   8 16:06 ?   0:00 /usr/sbin/httpd
5 S apache 64554 12064 TS   24 - 12203 semtim 26240   3 16:05 ?   0:05 /usr/sbin/httpd
5 S apache 54523 12064 TS   24 - 12956 -      29264   9 16:04 ?   0:08 /usr/sbin/httpd
5 S apache 30552 12064 TS   23 - 12924 132663 29316   8 16:02 ?   0:12 /usr/sbin/httpd
5 S apache 30535 12064 TS   24 - 12947 semtim 29324   1 16:02 ?   0:11 /usr/sbin/httpd
5 S apache  5311 12064 TS   24 - 13016 semtim 29716   4 15:53 ?   0:39 /usr/sbin/httpd
5 S apache 49148 12064 TS   24 - 12909 136421 30200   6 15:51 ?   0:44 /usr/sbin/httpd
5 S apache 46665 12064 TS   24 - 12943 semtim 29456   6 15:51 ?   0:47 /usr/sbin/httpd
5 S apache 12066 12064 TS   24 -  5542 354719  4072   4 10:53 ?   0:00 /usr/sbin/httpd

Encuentra los procesos php activos

lsof +r 1 -p `ps axww | grep httpd | grep -v grep | awk ' { if(!str) { str=$1 } else { str=str","$1}}END{print str}'` | grep vhosts | grep php