ajout lister fichier ouvert

This commit is contained in:
pdiogoantunes 2017-05-04 16:41:59 +02:00
parent 507394a28d
commit fc93a40e62

View file

@ -324,4 +324,18 @@ $ SEUIL=100; watch -n 5 -d "ps -e -o etimes=,user | sort -n | awk '{if (\$1<$SEU
~~~{.bash}
(total_procs=0; for foo in $(ps -e -o ppid | sed '1d' | sort -n | uniq -c | sort -n | awk '{ print $1 ":" $2 }'); do val=$(echo $foo | cut -d: -f1); total_procs=$((total_procs+val)); pid=$(echo $foo | cut -d: -f2); (( pid != 0 )) && { echo -n $val ') '; ps -p $pid -o pid,cmd | tail -n1; }; done; echo Total = $total_procs) | tail
~~~
## Process ayant des fichiers ouvert
### Selon l'utilisateur :
~~~
# lsof -u UID
~~~
Si www-data a uid=33, lister fichiers ouvert par serveur-web :
~~~
# lsof -u 33 | awk '{ print $2 " = " $9 }' | grep "/home/.*$"
~~~