Last active
October 16, 2021 13:10
-
-
Save 1951FDG/e6d6974b26533c93d97666896d9144a1 to your computer and use it in GitHub Desktop.
BubbleUPnP Server
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/sh | |
JAVACMD="/usr/bin/java" | |
HOMEDIR="$(dirname "${0}")" | |
cd "${HOMEDIR}" | |
# It is necessary to trap SIGTERM to return exit code 0 to launchd | |
_term() { | |
printf "%s\n" "Caught SIGTERM signal!" | |
kill -TERM $child 2>/dev/null | |
exit 0 | |
} | |
trap _term SIGINT | |
trap _term SIGTERM | |
# to make sure ffmpeg is found and used if present in start directory | |
export PATH=.:${PATH} | |
# -Xss256k: thread stack size. 256K reduces per-thread memory usage and may prevent "java.lang.OutOfMemoryError: unable to create new native thread" on some systems | |
# -Djava.awt.headless=true: required for image transcoding to work on headless systems (eg no X-Window libraries) | |
"${JAVACMD}" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dfile.encoding="UTF-8" -jar BubbleUPnPServerLauncher.jar $* & | |
child=$! | |
wait $child | |
rc=$? | |
if (( $rc == 2 )); then | |
rc=0; | |
fi | |
exit $rc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment