Is there a shell tool which can probe if a subprocess is still producing output, and otherwise kill it after a specified timeout?
offlineimap for Gmail backup, but that's very very very flaky. Processing stops regularily due to IMAP conditions or whatever. The process needs to be constantly restarted to see any progress. Hencewhy I'm currently using:
(ulimit -t 300 ; offlineimap)
in a loop. Which restarts the tool every five minutes; no matter what.
That's somewhat unsatisfactory, as it either kills the process prematurely the few times when it's actually still performing some work, or still waits 4 minutes longer when it's already blocking. I would rather have something like:
offlineimap > output.log & stillmakingoutput? --timeout 60 output.log || kill $!
That's probably doable with a custom exec/watching script, but isn't there some generic approach for such cases?