Created
May 11, 2022 09:38
-
-
Save mtsmfm/1214524c484ae2fa204fb4e8b09cff5a to your computer and use it in GitHub Desktop.
graceful shutdown with child process
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
trap 'kill "${child_pid}"; wait ${child_pid}; exit' TERM INT | |
ruby -e 'at_exit { sleep 3; p "exit" }; loop { p "sleep"; sleep 1 }' & | |
child_pid="$!" | |
sleep infinity & wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment