Shell pipeline q'n
Hi. This command writes a status line every 5 seconds:
Code:
$ zpool iostat -n -q 5 Code:
$ zpool iostat -n -q 5 | colrm 1 26 Code:
$ zpool iostat -n -q 5 | colrm 1 26 | colrm 85 I should note that it doesn't matter what the last command is, even cat -u, even head -n1 - it will hang. But if the "feeder" is killed, the expected output is delivered: Code:
$ timeout 15 zpool iostat -n -q 5 | colrm 1 26 | colrm 85 P.S.: this doesn't hang, so it must be something in colrm (and cut -b): Code:
$ zpool iostat -n -q 5 | cat | cat |
This is a very common problem. The output from the command is being buffered. If you wait for a while, a sudden rush of output will appear when the buffer is full (which is clearly not what you want).
Try running the zpool command via stdbuf or unbuffer, like this: Code:
stdbuf --output=L zpool iostat -n -q 5 | colrm 1 26 |
Quote:
zpool iostat -n -q 5 | stdbuf -o L colrm 1 26 | colrm 85 Code:
$ zpool iostat -n -q 5 | stdbuf -o L colrm 1 26 | colrm 85 |
All times are GMT -5. The time now is 06:22 PM. |