1. When making a thread, please tag your thread accordingly using the menu to the left of the textfield where you name your thread where applicable. Server Advertisements and Mod Releases should be contained to their respective subforums.

Server Discussion Can we actually have tools that make hosting a server less painful?

Discussion in 'Multiplayer' started by johnnyguitar, Dec 8, 2013.

  1. Katorone

    Katorone Giant Laser Beams

    The scripts in question run on IRC through an eggdrop, but I can share the general workings I guess:

    starbound is started with screen -dmS starbound launch_server.sh
    every 5 minutes this command is used to check CPU load: top -bn1 -p PID | awk /$p/'{print $9}'
    This gives a number relative to the amount of cores you have. If you have 8 cores, that means the maximum cpu load is 800.
    If the load is too high for your liking, you can either send a kill -int to the pid of the starbound server, or send a ctrl+c (\003) through the screen to the console.

    For memory: ps -p PID -o %mem
    # Players: netstat -nt | grep -c 21025 (or change to the port you're letting people play on)
     
    cavelurker likes this.
  2. Underbalanced

    Underbalanced Phantasmal Quasar





    Here ill add to your code to make some more options!

    Code:
    @@echo off
    :start
    cls
    netstat -np TCP | find /c "21025"
    netstat -np TCP | find /c "21025" > filename.txt
    ping 1.1.1.1 -n 1 -w 5000 >NUL
    goto start
    
    Here this will count the connections (you should subtract one for the listening). It will also save it to a file. You can make it an .html file and make an iframe within your website and have a player counter.

    Iframes
    http://www.w3schools.com/tags/tag_iframe.asp
    http://manda.com/iframe/



    Example coming soon!
     
    Last edited: Dec 9, 2013
  3. Underbalanced

    Underbalanced Phantasmal Quasar

    Last edited: Dec 9, 2013
  4. neonx

    neonx Yeah, You!

  5. Underbalanced

    Underbalanced Phantasmal Quasar

    My final technique.

    Code:
    @@echo off
    :start
    cls
    netstat -np TCP | find /c "21025"
    echo ^<font color^="Red"^> > sbbcount.html
    echo Players Online: >> sbbcount.html
    netstat -np TCP | find /c "21025" >> sbbcount.html
    echo ^</font^> >> sbbcount.html
    ping 1.1.1.1 -n 1 -w 10000 >NUL
    goto start
    Code:
     <iframe width="125" height="32" src="http://sbb.free-universe.com/sbbcount.html"></iframe>
     
    teihoo likes this.

Share This Page