Take the 2-minute tour ×  I've a Uni assignment I'm building
that I need to run multiple times with multiple different
parameters to check run times. At the moment I've a simple bash
script that looks a little like the below - it logs what it's
doing and the time results for each test, all normal output is
discarded (I'm checking correctness elsewhere, don't worry).
The problem is that sometimes (and it's fairly rare) the master
processes get stuck and never terminates, which obviously gets
in the way of finishing the test run. I'm working on fixing that
problem, obviously, but the algorithm is fine so I'd still like
to press on with testing as there's a hand-in date approaching.
So, I'd like some way of specifying the maximum run-time of the
processes, and if they exceed that I want them automatically
terminated (preferably by SIGINT, or some other identified
signal) and then the script to continue with the next entry. Or
any suitable alternative that has the same sort of result.
Snippet of what I have a