Results 1 to 8 of 8
  1. #1
    TFC admin DigitallyFidget's Avatar
    Join Date
    Mar 2014
    Location
    Walking across my keyboard
    Posts
    83

    About server downtime..

    I have an idea that may help with the server downtime, and I'd write the script for you, but I have no clue how you have the server setup.
    The script idea I have is to use a 30min. cron to check last logfile entry, and if it's the same line (server is frozen and thus not writing new entries), do a reboot of the server, to bring it back up from a hanging state.

    Simple method would be using a variable/file to store the last line of the logfile at the end of the script, and at the beginning do a check against that to see if it matches or not. With timestamps, even if the message is the same, the line won't be, due to the date/time print at the beginning of the line.





    Also, the server is currently down. 04:58CEST


    I'm a cat!

  2. #2
    The server last crashed 02:26 CEST, but it seems the restart script did not pick it up.
    Normally it scans the log for certain crashes, just looking at the last line would not have helped in thise case, the server was happily printing lines in the log still.

    J already has a script for that which scans for crashes in the logfile and tries to query the minecraft server for responses as well. Though occasionally the server hangs and there is no crash in the log and it is still responding to queries on the query port.

    One thing that might be improved from reading it is the name of the logfile to check. Most of the time its ForgeModLoader-server-0.log, but for some reason the server sometimes uses another name:
    ForgeModLoader-server-0.log ForgeModLoader-server-1.log ForgeModLoader-server-2.log
    ForgeModLoader-server-0.log.1 ForgeModLoader-server-1.log.1 ForgeModLoader-server-2.log.1

    So I guess the script could check which of those has the newest modification time and switch to that logfile, atm its ForgeModLoader-server-0.log.1 for example.

    Atm the server still responds to query and the script is checking the wrong log file, so its not restarting it. I'll restart it by hand now.

  3. #3
    Cake! InsaneJ's Avatar
    Join Date
    Jan 2012
    Location
    Cakeville
    Posts
    4,678
    Blog Entries
    21
    Stupid Minecraft servers that crash are stupid

    It's not as easy as it sound detecting whether a server is up or not. The best way is to just try to log on and see if you can. Unfortunately I don't know of a way to script that yet. Although I've seen someone who made an AI mod that could do it.

    For now I'll go add another check to the startup scripts to also monitor for secondary ForgeModLoader log files.

  4. #4
    Nearly done with that
    Im making it check the most recently changed ForgeModloader log with /home/minecraft_tfc01/ForgeModLoader-server-?.log{,.?}

  5. #5
    Cake! InsaneJ's Avatar
    Join Date
    Jan 2012
    Location
    Cakeville
    Posts
    4,678
    Blog Entries
    21
    Good busy! (literal Dutch to English translations FTW!!)

  6. #6
    It should check the most recent Forge log now, we'll just have to wait for the next server crash to see if it still works. Knowing TFC that should not take too long

  7. #7
    TFC admin DigitallyFidget's Avatar
    Join Date
    Mar 2014
    Location
    Walking across my keyboard
    Posts
    83
    So far, there's been no problems with restarts after crashes, so nothing was broken! Though it's hard to say if that'll do the trick or not. We'll see in the next week or two whether it happens again or not. I'll be sure to leave a follow up post here if I happen to see it occur again.


    I'm a cat!

  8. #8
    New Spawned
    Join Date
    Apr 2014
    Location
    McFarland WI
    Posts
    7
    Kodekat, I dont think that checking the log file and doing a simple string comparison is the way to go with this. A better choice would be to use .net or java to wrap the server with your own application and redirect STDOut and STDErr to this application, and have it monitor when the last read of the input stream returned. Its been a while since I last really looked at a MC server's output, but I dont remember there being a time stamp on the output. This would make it possible for the server to spit out the same message more than once, and dupe your scripts logic. If you decide to implement it this way, and want some examples, im sure I have code lying around that does exactly that.



    IGN - mwolfert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •