Last active
February 23, 2017 13:39
-
-
Save jasraj/9c1372ff1ec0615ead28ab082ce69ced to your computer and use it in GitHub Desktop.
Java Command Line Start - Linux
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
| #!/usr/bin/env bash | |
| # Start command used in BuaBook for all Java applications | |
| # Requires Java 7u101 or 8u92 for CrashOnOutOfMemoryError flag support | |
| JAR_TO_RUN=/path/to/jar.jar | |
| JAVA_LOG_FILE=/path/to/log/file.log | |
| JAVA_HEAPDUMP_LOC=/path/to/dump/dir/ | |
| JAVA_ERROR_FILE=/path/to/error/file.err | |
| nohup java -server \ | |
| -XX:+PrintCommandLineFlags -XX:+CrashOnOutOfMemoryError -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${JAVA_HEAPDUMP_LOC} \ | |
| -XX:ErrorFile=${JAVA_ERROR_FILE} -XX:+UseG1GC -XX:+UseStringDeduplication \ | |
| -Xms1024m -Xmx3072m \ | |
| -jar ${JAR_TO_RUN} \ | |
| < /dev/null >> ${JAVA_LOG_FILE} 2>&1 & | |
| ## Optional flags | |
| # -Djava.net.preferIPv4Stack=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment