Paul-Jürgen Wagner
2018-11-02 18:56:09 UTC
Dear Bashers,
I have a pipe who's last command ('analyse') should throw away the data
for a specified amount of time ('end') and then start processing it. My
current solution is
function analyse {
local count=<some sensible number>
while (( $(date '+%s') < end ))
do
dd bs=1024 count=$count status=none iflag=fullblock of=/dev/null
done
<now the magic starts>
}
This works reasonably, but I am pretty sure that there is a much smarter
solution to this, probably by using cat, putting it in the background,
sleeping for the skip-duration and then killing it? Any comments or
tips?
Thanks a lot,
Paul
I have a pipe who's last command ('analyse') should throw away the data
for a specified amount of time ('end') and then start processing it. My
current solution is
function analyse {
local count=<some sensible number>
while (( $(date '+%s') < end ))
do
dd bs=1024 count=$count status=none iflag=fullblock of=/dev/null
done
<now the magic starts>
}
This works reasonably, but I am pretty sure that there is a much smarter
solution to this, probably by using cat, putting it in the background,
sleeping for the skip-duration and then killing it? Any comments or
tips?
Thanks a lot,
Paul