mirror of
https://github.com/YunoHost-Apps/linuxdash_ynh.git
synced 2024-09-03 19:36:07 +02:00
13 lines
354 B
Bash
13 lines
354 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
result=$(/bin/ps axo pid,user,pcpu,rss,vsz,comm --sort -pcpu,-rss,-vsz \
|
||
|
| head -n 15 \
|
||
|
| /usr/bin/awk 'BEGIN{OFS=":"} NR>1 {print "{ \"pid\": " $1 \
|
||
|
", \"user\": \"" $2 "\"" \
|
||
|
", \"cpu%\": " $3 \
|
||
|
", \"rss\": " $4 \
|
||
|
", \"vsz\": " $5 \
|
||
|
", \"cmd\": \"" $6 "\"" "},"\
|
||
|
}')
|
||
|
|
||
|
echo "[" ${result%?} "]"
|