Skip to content

Instantly share code, notes, and snippets.

@Techcable
Last active November 23, 2018 20:22
Show Gist options
  • Save Techcable/4243b8f57b5715f417ee to your computer and use it in GitHub Desktop.
Save Techcable/4243b8f57b5715f417ee to your computer and use it in GitHub Desktop.
WarmRoast Wrapper
JAR_FILE=WarmRoast.jar
URL="http://builds.enginehub.org/job/warmroast/4523/download/warmroast-1.0.0-SNAPSHOT.jar"
SAMPLING_INTERVAL=10
if [ ! -e "$JAR_FILE" ];
then
echo attempting to download $JAR_FILE;
curl "$URL" > "$JAR_FILE";
fi;
if [ -z "$JAVA_HOME" ];
then
echo "\$JAVA_HOME is not set"
exit 1;
fi;
LIBRARY_PATH=$JAVA_HOME/jre/bin
TOOLS_JAR=$JAVA_HOME/lib/tools.jar
if [ ! -e "$TOOLS_JAR" ];
then
echo "Could not find tools.jar"
echo "Does JAVA_HOME point to a JDK?"
exit 1;
fi;
CLASSPATH="$TOOLS_JAR;$JAR_FILE"
if which cmd | grep [wW]indows > /dev/null; # We are on windows
then
echo "Windows detected, CLASSPATH=$CLASSPATH";
else
CLASSPATH=$(echo $CLASSPATH | sed s/\;/:/);
echo "Linux detected, CLASSPATH=$CLASSPATH";
fi;
java "-Djava.library.path=$LIBRARY_PATH" -cp "$CLASSPATH" com.sk89q.warmroast.WarmRoast --interval "$SAMPLING_INTERVAL"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment