fine tuned output, changed app: to either command: or daemon: , app isn't very accurate since it can be many things.

This commit is contained in:
inxi-svn 2010-02-16 23:02:01 +00:00
parent 585faeee28
commit e6f728dbf9

13
inxi
View file

@ -3227,6 +3227,7 @@ get_ps_data()
PS_THROTTLED=$PS_COUNT PS_THROTTLED=$PS_COUNT
PS_COUNT=5 PS_COUNT=5
fi fi
IFS=$'\n' IFS=$'\n'
# note that inxi can use a lot of cpu, and can actually show up here as the script runs # note that inxi can use a lot of cpu, and can actually show up here as the script runs
A_PS_DATA=( $( ps aux --sort $sort_type | grep -Ev "($SCRIPT_NAME|%CPU)" | $head_tail -n $PS_COUNT | gawk ' A_PS_DATA=( $( ps aux --sort $sort_type | grep -Ev "($SCRIPT_NAME|%CPU)" | $head_tail -n $PS_COUNT | gawk '
@ -4822,7 +4823,7 @@ print_ps_item()
{ {
eval $LOGFS eval $LOGFS
local a_ps_data='' ps_data='' line_starter='' line_start_data='' full_line='' local a_ps_data='' ps_data='' line_starter='' line_start_data='' full_line=''
local app_name='' app_pid='' app_cpu='' app_mem='' throttled='' local app_name='' app_pid='' app_cpu='' app_mem='' throttled='' app_daemon=''
local b_print_first=$2 line_counter=0 i=0 count_nu='' extra_data='' local b_print_first=$2 line_counter=0 i=0 count_nu='' extra_data=''
if [[ -n $PS_THROTTLED ]];then if [[ -n $PS_THROTTLED ]];then
@ -4852,7 +4853,15 @@ print_ps_item()
IFS="," IFS=","
a_ps_data=(${A_PS_DATA[i]}) a_ps_data=(${A_PS_DATA[i]})
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
app_name=" ${C1}app:${C2} ${a_ps_data[0]}"
# handle the converted app names, with ~..~ means it didn't have a path
if [[ -n $( grep -E '^~.*~$' <<< ${a_ps_data[0]} ) ]];then
app_daemon='daemon:'
else
app_daemon='command:'
fi
app_name=" ${C1}$app_daemon${C2} ${a_ps_data[0]}"
if [[ ${a_ps_data[0]} != ${a_ps_data[2]} ]];then if [[ ${a_ps_data[0]} != ${a_ps_data[2]} ]];then
app_name="$app_name ${C1}(started by:${C2} ${a_ps_data[2]}${C1})${C2}" app_name="$app_name ${C1}(started by:${C2} ${a_ps_data[2]}${C1})${C2}"
fi fi