Add snowmix wrapper to handle graceful shutdown

master
informatic 2018-08-14 22:02:24 +02:00
parent ba2f73cf6c
commit 851a2d37b1
2 changed files with 14 additions and 1 deletions

View File

@ -36,4 +36,4 @@ RUN mkdir $GOPATH && cd /tools/de-ip-hdmi && go get -d . && go build . && chmod
RUN sed -i -e 's_NC\=.*_NC="nc -q1"_' /usr/local/lib/Snowmix-0.5.1/scripts/snowmix-settings
USER snowmix
CMD snowmix
CMD [ "/tools/run-snowmix" ]

13
tools/run-snowmix Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
# Just a simple wrapper around snowmix, so that SIGTERM will make it shutdown
# gracefully
term_handler() {
echo 'quit' | nc -q1 127.0.0.1 9999
}
trap 'term_handler' SIGTERM
snowmix & wait ${!}
exit $?