I'm using the timeout function on debian to wait 5 seconds for my script.Works great but the problem I have is that I need a return value. Like 1 for timeout and 0 for no timeoutHow am I going to do this? Have a look at my code:timeout 5 /some/local/script/connect_script -x 'status' > output.txt# here i need the return of timeoutAs you see my connect_script -x 'status' returns the status as a string and print it to the screen (probably you can't see this) Background of this issue is that if the server (for connect_script) is freeze the script does nothing. That's why I need the timeout around that. And when it timeouts I want to restart the server. I can do that, but I have no idea how I can see if its timeout or not...
Timeout function return value
linux;bash;shell script;timeout
If timeout times out, it exits with status 124; you can check this to determine whether the script timed out or not.