Created
October 25, 2012 09:24
-
-
Save BowlingX/3951607 to your computer and use it in GitHub Desktop.
Bash Jar File Runner with log rotation
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 | |
set -e | |
XNAME="YourApp" | |
SCALATRA_ENV="production" | |
TMP_DIR="tmp/$XNAME/" | |
JAVA_OPTIONS=(-Xmx3024M -XX:MaxPermSize=512M) | |
LOGDIR="/usr/share/YourApp/logs/$XNAME" | |
PORT="9090" | |
JAVA_OPTIONS=("${JAVA_OPTIONS[@]}" "-Djava.io.tmpdir=$TMP_DIR") | |
JAVA_OPTIONS=("${JAVA_OPTIONS[@]}" "-Dorg.scalatra.environment=$SCALATRA_ENV") | |
cd "$(dirname "$0")/../" | |
rm -rf "$TMP_DIR"/* | |
exec java "${JAVA_OPTIONS[@]}" -jar current/YourJarFile.jar "$PORT" \ | |
> >(multilog t s131072 n100 '!/bin/gzip' $LOGDIR) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment