Skip to content

Instantly share code, notes, and snippets.

@Yxogenium
Last active June 15, 2016 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yxogenium/b9a67d0f327a35bf3446 to your computer and use it in GitHub Desktop.
Save Yxogenium/b9a67d0f327a35bf3446 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
mkdir -p "build" "bin"
if [[ ! $(find bin/ -name "spigot*.jar" -mtime -7) ]]; then
(echo "Spigot is older than a week"
cd "build" &&
curl -o "BuildTools.jar" -z "BuildTools.jar" "https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar" &&
java -jar "BuildTools.jar" &&
spigotBuild=$(basename spigot*.jar) &&
spigotName="${spigotBuild%.*}-$(date -Iseconds).jar" &&
cp "$spigotBuild" "../bin/$spigotName" &&
ln -sf "bin/$spigotName" "../spigot.jar") || echo "Failed to build spigot.jar, running server with the old one."
fi
java -server -XX:+DisableExplicitGC -jar "spigot.jar"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment