Shell pipeline q'n
by rihad from LinuxQuestions.org on (#5QJ74)
Hi. This command writes a status line every 5 seconds:
Code:$ zpool iostat -n -q 5
capacity operations bandwidth syncq_read syncq_write asyncq_read asyncq_write scrubq_read trimq_write
pool alloc free read write read write pend activ pend activ pend activ pend activ pend activ pend activ
---------- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
zroot 167G 473G 398 209 17.8M 5.14M 0 0 0 0 0 0 0 0 0 0 0 0
zroot 167G 473G 0 42 19.3K 281K 0 0 0 0 0 0 0 0 0 0 0 0
^CI'm not interested in the pool name, capacity, scrub and trim operations, so I decide to use colrm to get rid of them. First the left hand side:
Code:$ zpool iostat -n -q 5 | colrm 1 26
operations bandwidth syncq_read syncq_write asyncq_read asyncq_write scrubq_read trimq_write
read write read write pend activ pend activ pend activ pend activ pend activ pend activ
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
398 209 17.8M 5.14M 0 0 0 0 0 0 0 0 0 0 0 0
^CSo far so good. Now for the right hand side:
Code:$ zpool iostat -n -q 5 | colrm 1 26 | colrm 85This doesn't output anything and hangs until Ctrl+C is pressed!
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
operations bandwidth syncq_read syncq_write asyncq_read asyncq_write
read write read write pend activ pend activ pend activ pend activ
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
398 209 17.8M 5.14M 0 0 0 0 0 0 0 0
0 33 0 214K 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0What the $#$% is going on? Thanks for any advice.
P.S.: this doesn't hang, so it must be something in colrm (and cut -b):
Code:$ zpool iostat -n -q 5 | cat | cat
Code:$ zpool iostat -n -q 5
capacity operations bandwidth syncq_read syncq_write asyncq_read asyncq_write scrubq_read trimq_write
pool alloc free read write read write pend activ pend activ pend activ pend activ pend activ pend activ
---------- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
zroot 167G 473G 398 209 17.8M 5.14M 0 0 0 0 0 0 0 0 0 0 0 0
zroot 167G 473G 0 42 19.3K 281K 0 0 0 0 0 0 0 0 0 0 0 0
^CI'm not interested in the pool name, capacity, scrub and trim operations, so I decide to use colrm to get rid of them. First the left hand side:
Code:$ zpool iostat -n -q 5 | colrm 1 26
operations bandwidth syncq_read syncq_write asyncq_read asyncq_write scrubq_read trimq_write
read write read write pend activ pend activ pend activ pend activ pend activ pend activ
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
398 209 17.8M 5.14M 0 0 0 0 0 0 0 0 0 0 0 0
^CSo far so good. Now for the right hand side:
Code:$ zpool iostat -n -q 5 | colrm 1 26 | colrm 85This doesn't output anything and hangs until Ctrl+C is pressed!
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
operations bandwidth syncq_read syncq_write asyncq_read asyncq_write
read write read write pend activ pend activ pend activ pend activ
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
398 209 17.8M 5.14M 0 0 0 0 0 0 0 0
0 33 0 214K 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0What the $#$% is going on? Thanks for any advice.
P.S.: this doesn't hang, so it must be something in colrm (and cut -b):
Code:$ zpool iostat -n -q 5 | cat | cat