Created
October 16, 2015 10:00
-
-
Save jmtd/381306acafd16e656d1a to your computer and use it in GitHub Desktop.
blah
This file contains hidden or 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
echo parent pid is $BASHPID | |
bollocks() { | |
pidfile=$(mktemp -t bollocks.XXXXXX) | |
ls -ld "$pidfile" | |
( | |
echo $BASHPID | tee "$pidfile" | |
sleep 30 | |
rm "$pidfile" | |
) & | |
count=0 | |
timeout=5 | |
while test -e "$pidfile"; do | |
if [ "$count" -ge "$timeout" ]; then | |
echo "giving up, DIE DIE" | |
kill -9 $(cat "$pidfile") | |
break | |
fi | |
echo "parent: still there..." | |
((count += 1)) | |
sleep 1 | |
done | |
echo "it's gone!" | |
} | |
bollocks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment