Skip to content

Instantly share code, notes, and snippets.

@iocanel
Created September 11, 2015 13:30
Show Gist options
  • Save iocanel/0a33dc5c89e06e0dcec9 to your computer and use it in GitHub Desktop.
Save iocanel/0a33dc5c89e06e0dcec9 to your computer and use it in GitHub Desktop.
Signal trapping in Docker tests
#!/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
@rhuss
Copy link

rhuss commented Sep 11, 2015

yeah, you're the man ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment