Expanding my brains and flushing Google to find a way to get a command semwith a timeout parameter to give me a timeout exit code. It doesn’t have to be through sem, it’s just a pain, because I need to end up applying actions in different ways depending on whether:
The semaphore is used in this case to switch calls to a script for which I pass a list of file names for the outgoing message queue. As you can see in the example of a rough test below, I can deal with the first two scenarios, but I can’t get anything for life that I can use from a process that ends in a timeout (i.e. outputtest.shhas sleep 6; echo testings)
sem --jobs 3 --timeout 3 -u \
'runproc=$(bash outputtest.sh q_xxxx); if [ "$runproc" == "00" ];
then echo "OK"; else mv ./q_xxxx ./err/err_xxxx; fi'
Any clues?
source
share