I've written a program that is suppose to run for a long time and it outputs the progress to stdout
, however, under some circumstances it begins to hang and the easiest thing to do is to restart it.
My question is: Is there a way to do something that would kill the process only if it had no output for a specific number of seconds?
I have started thinking about it, and the only thing that comes to mind is something like this:
./application > output.log &
tail -f output.log
then create script which would look at the date and time of the last modification on output.log
and restart the whole thing.
But it looks very tedious, and i would hate to go through all that if there were an existing command for that.