1. Axy

    Axy

    I've finally set up a rust server on a proper dedicated server.
    Now I need to know how to manage auto restarts (daily, or every 12 hours) and restarts at possible server crashes.

    Is this easily possible?

    Thank you.
     
  2. Have the batch file auto-restart the server.

    Example:
    Code:
    @echo off
    :10
    serverstarthere
    echo Restarting Server!
    goto 10
    
    Then u should be able to use the TimedExecute plugin to setup automatic restarts by executing the server command 'exit', don't forget to save before hand just in case.
    TimedExecute for Rust | Oxide
     
  3. Axy

    Axy

    Thank you fro your answer.
    One small detail I forgot to mention: I need to find a solution that will work for both modded and unmodded servers (as only one of my servers is modded atm)
     
  4. Ah i see...
    Assuming that both servers are running on the same server, you can use TASKKILL, also doing it this way will mean that you wont need a plugin on the oxide server either.
    1. Create a batch file, maybe in c:\scripts or something, call it KillRustServers.bat
    2. Create a new scheduled task in Windows to call this KillRustServers.bat every x hours or whatever you want your restart procedure to be.
    3. Inside KillRustServers.bat, put the following:
      Code:
      TASKKILL /IM "RustDedicated.exe"
      
      You can also use the /F switch to forcefully close the application (this emulates closing a process via Task Manager for example) - However this could lead to save file corruption

    4. Save the file, now whenever the scheduled task runs, the RustDedicated.exe processes will be told to shutdown gracefully, then your :10 goto 10 segment of the rust servers batch file will take hold and restart the servers for you.

      Please note:
      TaskKill will kill ANY process running with the name given, if you have 10 RustDedicated.exe processes running, taskkill will send the stop command to each one.
     
  5. Axy

    Axy

    Thanks for the detailed description.
    The only section I need more explanation is section 4. What do you mean by :10 goto 10?

    Also, is it possible to send a server message 10 minutes before the shutdown?

    Thanks!
     
  6. No problem.
    Sorry the :10 goto 10 is my programming side coming out, let me explain it more in depth.

    You're servers starting batch file might look something like this:
    Code:
    @echo off
    cls
    :startRustDedicated -batchmode -nographics +server.ip 0.0.0.0 +rcon.ip 0.0.0.0 +server.port 28015 +rcon.port 28016 +rcon.password "changeme" +server.maxplayers 10 +server.hostname "My Oxide Server" +server.identity "my_server_identity" +server.level "Procedural Map" +server.seed 12345 +server.worldsize 4000 +server.saveinterval 300 +server.globalchat true +server.description "Powered by Oxide" +server.headerimage "http://oxidemod.org/styles/oxide/logo.png" +server.url "http://oxidemod.org"@echo.
    @echo Restarting server...
    @echo.
    goto start
    
    The :10 goto 10 referrers to the :start, goto start elements of the file, just in case you are unsure what these do:
    :start is the name of a label in a batch script, labels are like anchor points within a batch file, at any point you're able to tell the command processor to jump back to a label, you do this via goto LABELNAME (in this case, start).

    So, here is what the batch file does:
    1. @echo off - This stops the command processor from printing such things as current working directory paths, it also makes using the 'echo' command more friendly.
    2. cls - this clears the command prompt screen of all text
    3. :start - create a new label here
    4. RustDedicated - Start the rust dedicated server, the command processor will stop here until the RustDedicated.exe process has ended.
    5. echo Restarting Server... - Echo "Restarting Server..." to the command prompt window
    6. goto start - Jump back up to the start label and continue execution (in this instance, it will jump back up to number 4)
    This creates a loop, where if the RustDedicated.exe either was turned off, or a crash happened the command processor would restart the process.

    In answer to your server message query, Yes! - but ONLY in your Oxide-Enabled server, you can again use the TimedExecute plugin for this.

    While it could be done for your un-modded server, it's not currently possible unless someone builds a command-line RCON tool for Rust to push commands to the server before a shutdown is initiated.