Skip to content

Instantly share code, notes, and snippets.

@adamrneary
Created April 19, 2016 19:18
Show Gist options
  • Save adamrneary/52fd209ff11c1a49ec3329c3f10b07fb to your computer and use it in GitHub Desktop.
Save adamrneary/52fd209ff11c1a49ec3329c3f10b07fb to your computer and use it in GitHub Desktop.
#!/bin/bash -x
log=$1
shift
for try in 1 2 3
do
"$@" 2>&1 | tee $log &
sleep 30
if grep -q Running $log
then
wait
rv=$?
break
else
kill %1
sleep 1
rv=1
fi
done
exit $rv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment