Created
September 24, 2018 17:39
-
-
Save hmpmarketing/4f974d9247351869d09b67c2597a9d1a to your computer and use it in GitHub Desktop.
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 | |
| main() { | |
| pm2-docker start ${BOT_NAME}.json & | |
| # Setup signal handler | |
| trap 'sigtermHandler' SIGTERM | |
| sleep 10 | |
| while [[ -n "$(pgrep [Pp][Mm]2)" ]] | |
| do | |
| tail -f /dev/null --pid $(pgrep [Pp][Mm]2) | |
| done | |
| } | |
| sigtermHandler() { | |
| echo "SIGTERM Trapped!" | |
| pm2-docker stop all | |
| } | |
| main | |
| exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment