Spigot Auto Updater

Discussion in 'Server & Community Management' started by roombascj, Apr 1, 2016.

  1. Is there a way i can auto update spigot once every day. If so, can you please tell me.
     
  2. Trust me you don't want to do that. What happens if it isn't compatible with some of your plugins? Unless you are COMPLETELY vanllia it would be very risky
     
    • Agree Agree x 1
  3. Its okay if it isn't compatible, its mainly just as a test.
     
  4. You'd have to do the following in a cron job:
    • Run BuildTools
    • Stop your server
    • Move new spigot jar to existing location
    • Start your server
    Here's an example in bash:
    Code (Bash):
    #!/usr/bin/env bash

    buildtools_dir="/home/user/buildtools"
    buildtools_jar="$buildtools_dir/BuildTools.jar"
    server_dir="/home/user/server"
    spigot_jar="$server_dir/spigot.jar"

    # Run BuildTools
    java -jar "$buildtools_jar"

    # Stop Server (If you use a screen or a web panel you should probably change this)
    pid=`ps -aefw | grep "spigot.jar" | grep -v " grep " | awk '{print $2}'`
    while kill $pid > /dev/null 2>&1
          sleep 15
    do
        # Killing Process
    done

    # Just Incase, Kill With Fire
    kill -9 $pid > /dev/null 2>&1

    # Move New Jar
    rm -f "$spigot_jar"
    mv "$buildtools_dir/spigot-*-.jar" "$spigot_jar"

    # Start Server (If you use a screen or a web panel you should probably change this)
    java -jar "$spigot_jar"
     
    #4 CraftedFury, Apr 2, 2016
    Last edited: Apr 2, 2016
  5. @CraftedFury That looks like a hard kill to me. Wouldn't you first want to try a soft kill? Then after 10-15 seconds a hard one?
     
  6. I modified the kill command to send a soft kill and wait 15 seconds before trying a soft kill again, then attempting the hard kill.