I have often a situation in Linux shell scripts that if a specific command takes too long to run e.g. due to a network problem the shell script should abort running this command.
What best practices there exist to run timeoutting commands in a shell script? E.g. run commands through some kind of monitoring command with certain maximum running time given as seconds?
what I am looking for is to have something like "timeout -s 300 'this command line'"
Cron solutions are out of the question and not accetable answers.