Przeglądaj źródła

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 lat temu
rodzic
commit
16950f64f1
1 zmienionych plików z 1 dodań i 4 usunięć
  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')