Просмотр исходного кода

Rollback to top command for task list using PID as matching string for grep.

Fixed the original command by using PID as matching string so it is compatible with other languages than English.
DieFeM 7 лет назад
Родитель
Сommit
16950f64f1
1 измененных файлов с 1 добавлено и 4 удалено
  1. 1 4
      ogp_agent.pl

+ 1 - 4
ogp_agent.pl

@@ -3976,10 +3976,7 @@ sub shell_action
 	elsif($action eq 'get_tasklist')
 	{
 		my %taskList;
-		my $ps = 'ps -p $(ps --no-headers -a -o tty,pid|grep ^[^?] | awk -vORS=, \'{ print $2 }\' | sed \'s/,$/\n/\') -o comm,etime,%cpu,%mem,args';
-		my @res = `$ps`;
-		my $selfcommand = pop(@res);
-		$taskList{'task'} = encode_base64(join("", @res));
+		$taskList{'task'} = encode_base64(qx[top -b -c -i -w512 -n2 -o+%CPU|awk '/^top/{i++}i==2'|grep 'PID' -A 30]);
 		return {%taskList};
 	}
 	elsif($action eq 'get_timestamp')