Created
September 11, 2015 13:30
-
-
Save iocanel/0a33dc5c89e06e0dcec9 to your computer and use it in GitHub Desktop.
Signal trapping in Docker tests
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
#!/bin/bash | |
function cleanup { | |
echo "Cleaning Up!" | |
echo "Container $HOSTNAME exited" > /path/to/volume | |
} | |
echo "My pid is $$" | |
trap 'kill ${!}; cleanup' SIGTERM | |
trap 'kill ${!}; cleanup' SIGKILL | |
trap 'kill ${!}; cleanup' SIGINT | |
//hide dind stuff so Jimmi won't find out. | |
sleep infinity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works for me: