On 19/03/2022 19:06, Ben Bacarisse wrote:
frogger <[email protected]> writes:
I wrote a shell scraper of a news website and one of the options is to
keep re-accessing the initial webpage (while loop) at regular
intervals, grab all news links and scrape text of the ones which are
new. This option keeps the script running for days straight. When
stdout is redirected to a *file*, it works as expected.
Instead if we pipe output to `less', there is a buffering stand. When
`less' buffering is full at about 8-64KB, the whole while loop in the
script hangs and only continues to run when we scroll down `less'
display buffer. But if it hangs for a few hours, it means the scraping
tool will only resume scraping some hours later, too, failing to
scrape a lot of news from the initial webpage during that time.
I'm not 100% sure what you want, but does:
$ scraper >file & less file
and then using the F command do something like you want?
Hey Ben!
That is *exactly* what I am trying just now. Was not sure it would be a
good solution but it seems straightforward that is, as it was so obvious
to you.
So what I just did and works is:
scraperFunction >file & tail -f file | less
Also added a trap inside the script to kill forks and remove temp file.
Thanks, Ben!
JSN
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)