Archived Forum Post

Index of archived forum posts


SSH mpstat command with update parameter and pipe awk

Mar 15 '13 at 04:57


I have a problem when running mpstat command with update parameter and awk command (Linux 2.6).

When I sent command mpstat, I receive data. With awk (mpstat | awk '{print $3,$4,$5,$6,$7,$8,$9,$10,$11}'), I receive data too.

Now, I add update parameter: I receive data with mpstat alone: mpstat 10. But with awk, I never receive data, I have no error : mpstat 10 | awk '{print $3,$4,$5,$6,$7,$8,$9,$10,$11}'

int channel = ssh->OpenSessionChannel();

if( !ssh->SendReqExec(channel, "mpstat 10")


do {

if( ssh->ChannelPoll(channel, 1000) <= 0 ) continue; // with awk, always timeout

String ^ res = ssh->GetReceivedText(channel, "ansi");

if( res != nullptr ) System::Console::WriteLine(res);

} while(true);

I don't understand what it is happen. Have you any idea ?

Thanks for your answers.