Created
September 29, 2016 20:51
-
-
Save scottsbaldwin/607fa2cf565cefede6b66e69296f34bf to your computer and use it in GitHub Desktop.
Execute a function on docker stop
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
#!/bin/sh | |
handler() { | |
echo "Caught SIGTERM signal" | |
exit $((15+128)) | |
} | |
i=0; | |
trap 'handler' SIGTERM | |
while [ $i -lt 600 ]; do | |
echo Hello world!; | |
((i=i+1)); | |
sleep 1; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment