Skip to content

Instantly share code, notes, and snippets.

Created Aug 24, 2017
What would you like to do?
# Terminate running screen, if it exists
if screen -list | grep -q "botscreen"; then
echo "Terminating current bot instance"
screen -S botscreen -p 0 -X stuff "stop^M"
echo "No current bot instance found"
# Parse API data to find file name of latest build
filename=$(curl -s | jq -r '.artifacts[0].fileName')
# Check if bot is up to date
if [ -e $filename ]; then
# If it is, do nothing
echo "Bot up to date!"
# Otherwise, delete and redownload
# Remove old bot jar
echo "Deleting old jar"
rm -f MCBot-*.jar
# Download new bot jar
echo "Downloading new file: $filename"
wget "$filename"
# Start new bot instance
echo "Starting screen"
screen -dmS botscreen java -jar $filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment