Ports and servers keep crashing for months..

Discussion in 'Systems Administration' started by KevinEssence, May 19, 2015.

  1. Some of my servers keep crashing after a few days, auto restart every 12-24 hours, but anywho it crashes and spams my console like this non stop! This causes so much lag until I get on and unbind port. The things is when I try to start it up even after unbinding port it still spams the image below saying it's bound. When I go in game the server is up though, I just can't view the screen anymore because the one I view looks like below. I have to restart the box every day just to fully unbind them because it starts up even when I do so if I don't. If you know why please assist me. I'm getting quite frustrated. Usually only happens to our creative server and hub. Something to do with java?
    [​IMG]
     
  2. You have to disable crash restarts in the spigot.yml I think.

    Basically, once Spigot crashes, it starts a new server using the startup script, but it is not in the screen. So when the startup script tries to reboot, it can't because the server is already running on that port.
     
  3. Thank you very much mattrick. I will give this a go next time we restart the boxes, hoping to squash it soon. ;)
     
  4. Yeah no problem :)
     
  5. One of the things that we do it to specifically kill the java process that would be running if it is still running after a restart or crash

    An example of our startup script be like this

    Code (Text):
    #!/bin/sh

    #
    # settings
    #
    # Change if you need to change what jar you are running
    jar="spigot-1.8-R0.1-SNAPSHOT.jar"
    # java runtime options
    javaInitialMemSize=4G
    javaMaximumMemSize=32G
    # If you need to do a more advanced options do them here
    javaOptions=" -Xms$javaInitialMemSize -Xmx$javaMaximumMemSize -server -XX:SurvivorRatio=15 -XX:TargetSurvivorRatio=90 -XX:MaxGCPauseMillis=500 -XX:+UseAdaptiveGCBoundary -XX:PermSize=128m -XX:MaxPermSize=256m -DconvertLegacySigns=true "
    # console can contain "error", "debug", "info"
    console=( "error" "debug" "info" )

    #
    # functions
    #
    logger() {
      local level=null
      local timestamp=$(date +%H:%M:%S)
     
      if [ ! -a "$bindir/.logger_lock" ]; then
        for i in "${console[@]}"; do
          if [ $1 == $i ]; then
           echo "["$timestamp ${1^^}"]:" $2
           break
          fi
        done
      fi
    }

    #
    # main
    #
    bindir=$(dirname "$(readlink -fn "$0")")
    cd "$bindir"

    while true :
    do  
      cd "$bindir"
      logger "debug" "Server running at $bindir"
      java $javaOptions -jar $jar nogui
      echo
      logger "info" "If you want to completely stop the server process now, press [Ctrl] + [C]."
      sleep 3
      logger "info" "Rebooting in:"
      for i in 5 4 3 2 1 ; do
        logger "info" "$i ..."
        sleep 1
      done
      logger "debug" "Killing still running java process."
      killall java $javaOptions -jar $jar nogui
      logger "info" "Rebooting now!"
    done

     
    This may not be the best way to do this but it is one of the ways we have done it
     
    • Informative Informative x 1
  6. Thank you.