Created
October 6, 2012 09:35
-
-
Save swiftgeek/3844495 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timer=0 | |
timeout=300 | |
index=0 | |
for arg in $@ ; do | |
let "index++" | |
if [ $index -lt $# ]; then | |
for (( ii=25 ; i<1; i-- )) ; do | |
[[ -n "$(pgrep $arg)" ]] && echo "Found $arg" && continue 3 | |
[[ $ii -eq 1 ]] && echo "Failed on waiting for $arg" && exit | |
[[ $timer -ge $timeout ]] && echo "Timeout after $timer" && exit | |
sleep 5 | |
let "timer+=5" | |
done | |
fi | |
sleep 5 | |
echo "Executing $arg" | |
exec $arg | |
done | |
echo "This shouldn't happen" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment