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.

Tutorial Server Admin Tools - Chat Log\Connected Users List\Crash AutoRestart - No GUI Required!

Discussion in 'Multiplayer' started by SpikeTheSpaceCowboy, Dec 14, 2013.

  1. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    **Updated to work with latest build, Offended Koala!**
    - If you have any feature requests, feel free to leave a reply in this thread and I'll see what I can do.

    Instructions:

    Connected Users List
    1. Download and Install [Python 2.7.6] here - You must install to the default directory, eg. "C:\Python27"

    2. Download and extract [the connected users script] here.

    3. Run Connected Users.bat - Make sure to change the filepath in the .bat file to where you saved the .py file.

    * **Note:** This script assumes the path to the starbound server log is:
    - "C:\Steam\Steamapps\common\Starbound"

    * If that is not the directory you have installed Starbound to, either move it there, or point to the correct directory by editing the .py file included in the archive. [Edit this line].

    ** This will create a players.txt file, so you can keep a log of when players connected to your server.

    Chat Log
    1. Download and Install [Python 2.7.6] here - You must install to default directory, eg. "C:\Python27"

    2. Download and extract [the chat log script] here.

    3. Run ChatLog.bat - Make sure to change the filepath in the .bat file to where you have saved the .py file.

    * **Note:** This script assumes the path to the starbound server log is:
    - "C:\Steam\Steamapps\common\Starbound"

    * If that is not the directory you have installed Starbound to, either move it there, or point to the correct directory by editing the .py file included in the archive. [Edit this line].

    Server Error Check
    1. Download and Extract [Server Error Check.zip]

    2. Change the [Local Server IP] & [Filepath to ServerRestart.bat] in ServerErrorCheck.bat

    3. Change [Filepath to Starbound Installation] in ServerRestart.bat

    4. Run ServerErrorCheck.bat

    That's it! :p

    ---------------------------------------------------------------------------------------------------------------

    [​IMG]
    Hey guys, don't know if this will help anybody out but here's a link to a python script that will give you a list of connected players. As well as a total number of connected players. It will update every 30 seconds.

    I also threw in a timer that counts down from 12 hours 5 mins. to remind you when to restart the server. It can easily be changed to whatever interval you would like.

    It even writes it all to a nice little text file and timestamps it, so you can keep a log of who is on your server at what time.
    Newly Implemented - I have thrown together a script that will give you the servers chat log!

    You can find the files on github here: [Link]
    Disclaimer: I did not write the original connected users code, I only added the looping, file writing, server restart reminder, and timestamping aspects. Original credit goes to sethdmoore/mcapplbee.


    ** This is the windows fork of another project that was built for Linux hosted servers. It seems that project is now dead, if there is enough interest I will port this over to Linux and develop both branches simultaneously **
     
    Last edited: Dec 17, 2013
  2. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    Just a quick bump. I'm planning on also adding some more features. Such as, the time a user connected and IP address of that user next to there name. And incorporating bans, through the use of windows firewall rules. Let me know if you have any other requests.
     
  3. Senjai

    Senjai Void-Bound Voyager

    I don't mean to be rude, but that code is atrocious. Also windows firewall rules? Bad idea. You can see that the other guy (sethd) uses iptables for this (also a bad idea) and anything requiring root to function is bad (e.g. the shell script).

    The best way to do this would be in a vagrant virtual linux box with the iptables method, or better, without using the virtual box set up a proxy application in front of the server and delegate messages to the server after processing them.
     
  4. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    Oh, no this is the Windows branch of sethd's original project. Which means I have to work with the tools built into windows already, which leaves me with windows firewall rules. I can see why you think this code looks nasty, but trust me it is the best way to get it to do what I need it to do. Feel free to comment specific changes you think would help make it better, or even forking your own project off of it ;p

    I do understand that a Linux environment is much more accommodating for this type of scripting, but I want this to be for server admins that are only familiar with a windows environment.
     
  5. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    Script has been updated to work with latest release, Offended Koala!
     
  6. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    Added instructions so everyone can easily get the script up and running.
     
  7. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    If anybody has any request for features, feel free to leave a reply here and I'll see about getting them in for you.
     
  8. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    Possible Linux branch of this projected will be revived if I get enough interest. Leave a comment or shoot me a PM.
     
  9. Payroll

    Payroll Pangalactic Porcupine

  10. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    I have ~working, crippled implementations of these features, its a busy week though, getting ready for holiday break at work :p

    Look for a release definitely by this weekend. I was hoping to stop development since so many other tool sets are coming out, and I'm just a weekend warrior coder, but they are all overly taxing imo, and only offer GUI, or have no windows support, so i'll see what kind of need there is for my lackluster tools :p

    Leave a reply here if you want to see continued development, or feel these are just redundant projects.
     
  11. Payroll

    Payroll Pangalactic Porcupine

    I'm not looking for anything fancy, just to be able to kick or ban people right now.
     
  12. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    Well I say crippled, because I'm currently using python 2.7.6 and don't have access to the ipaddress module from 3, so its a little dirty :p ill migrate over and clean it all up when I get time throughout the week.
     
  13. Payroll

    Payroll Pangalactic Porcupine

    Err, that's the part i'm stuck at! lol. I just can't connect to the server witht he clients I have either otherwise I'd remote the file from the server as a local command.
     
  14. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    I'm confused? It's probably because my brain is already fried from work this week. Are you able to use the currently published script on your server remotely? Basically its just parsing the server log and outputting that data to a text file. As long as you have python installed, and command line access you should be able to run it.
     
  15. Payroll

    Payroll Pangalactic Porcupine

    That's the problem. I can't connect to my server even tho the info is correct. Otherwise I could use the client to remotely kick ban from the server itself by closing the connection locally from the server using the clients remote.

    What I'm thinking is this. Installing the admin control software with the admin controls onto the hosted server then using the remote client to generate the admin controls from the hosted server, remotely then using the remote just to kick ban from the hosted server.
     
  16. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    **Added a Chat Log Script**

    Had a few minutes tonite so knocked out a quick chat log script. Make sure to change the filepath in the .bat file if you are going to run it that way.
    To change the file path> right click the .bat > select edit > change [insert correct filepath here] to the saved path of the .py file
     
  17. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    Here's a quick and dirty server crash check and restart script to hold you over until I finish a proper one this weekend. The only bug I can think of right now, is a direct ddos attack, I assume it will go into a loop of server restarts, but that's just a theory. Let me know if you encounter anything and i'll fix it quick. If you are going to use this script, make sure to change the [Local Server IP] to the correct address, and the path to the ServerRestart.bat

    Code:
    @ echo off
    set number=0
    
    :errorcheck
    netstat -o -n -a | findstr [Local Server IP]:21025 | findstr CLOSE-WAIT
    if %ERRORLEVEL% equ 0 (goto killserver) ELSE (goto waiting)
    
    :running
    echo Server is Running
    echo %number% Restarts today.
    if not "%number%" == "0" echo Last Restarted %restarttime%
    timeout /t 30 /nobreak
    goto errorcheck
    
    :waiting
    netstat -o -n -a | findstr [Local Server IP]:21025 | findstr ESTABLISHED
    if %ERRORLEVEL% equ 0 (goto running) ELSE (goto tryagain)
    
    :tryagain
    timeout /t 30 /nobreak
    goto errorcheck
    
    :killserver
    killtask starbound_server.exe
    timeout /t 10 /nobreak
    set /a number=number+1
    set cur_hh=%time:~0,2%
    if %cur_hh% lss 10 (set cur_hh=0%time:~1,1%)
    set cur_nn=%time:~3,2%
    set cur_ss=%time:~6,2%
    set cur_yyyy=%date:~10,4%
    set cur_mm=%date:~4,2%
    set cur_dd=%date:~7,2%
    set timestamp=%cur_hh%:%cur_nn%:%cur_ss% - %cur_mm%/%cur_dd%/%cur_yyyy%
    set restarttime=%timestamp%
    goto serverrestart
    
    :serverrestart
    start ~\ServerRestart.bat
    ping 127.0.0.1 -n 1
    goto wait
    
    :wait
    timeout /t 60 /nobreak
    echo Server Restarted
    goto errorcheck
    
    ServerRestart.bat
    Code:
    @ echo on
    ~\starbound_server.exe
     
    Last edited: Dec 17, 2013
  18. SpikeTheSpaceCowboy

    SpikeTheSpaceCowboy Tentacle Wrangler

    Updated image, so you can see how everything looks when running ;p
     
  19. SxeMary

    SxeMary Master Chief

    Will this be updated for Angry Koala or maybe the next update?
     
  20. Phoenix_GT

    Phoenix_GT Void-Bound Voyager

    Who has sourcse code of those files. Anyone?
     

Share This Page