Created
September 25, 2015 10:39
-
-
Save booyaa/47b6a1f3694b47663e42 to your computer and use it in GitHub Desktop.
catch ctrl-c and exit (but not sigterm 9)
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 | |
| trap -- 'cleanup; exit' SIGINT SIGTERM | |
| cleanup() | |
| { | |
| echo cleaning up | |
| echo now | |
| } | |
| while true; | |
| do | |
| echo boing! | |
| sleep 5 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment