2

timeout is nice for killing a command that does not complete within n seconds.

Is there a similar command to kill a command that has not printed anything on stdout for n seconds (and which therefore is probably stuck)?

Edit:

socat -T120 'exec:python3 /Users/Name/Desktop/pythoncode.py' -

works nice, except it does not set $? if the job is killed. Is there a way I can make socat do that?

Ole Tange
  • 33,591
  • 31
  • 102
  • 198
  • Possible duplicate of [I want to terminate a python script if it doesn’t output anything to the terminal in 2 min](//unix.stackexchange.com/q/626909) – Stéphane Chazelas Jan 27 '22 at 06:01

0 Answers0