• Crash Watchdog and Timed Restart batch files for Windows Dedicated Server with autoupdate.
    18 replies, posted
Going to preface by saying that These scripts are not completely original work, picked bits and pieces for other batch files out there. The following combination of one text file and two batch files will allow your server to: Update on (re)Start Restart on Crash and Restart after X second online. [URL="http://pastebin.com/MAyVkJ8s"]rust_ds.txt[/URL] - Place in same folder as steamcmd.exe [URL="http://pastebin.com/mJnrrs1A"]rustserver.bat[/URL] - Place in folder you want to contain your server save folder. Edit the Variables at the top with your exe locations and server options. [URL="http://pastebin.com/E09HpNys"]rustrestarter.bat[/URL] - Place in same folder as rustserver.bat Edit time variable with number of seconds you want to wait to restart. Default: 1 hour. Using these three components, all you have to do is run rustserver.bat and your server will stay online and up-to-date. If the server crashes, the re-starter is restarted as well, which resets the time delay. Close both cmd windows if you would like to turn off the server.
Using this I was the only available server period for about a half hour this morning.
After downloading and modifying the bat files for my folders, running these makes a PING.EXE process go crazy for some reason, other wise with my simple bat start up no PING.EXE is running in task manager. do not know why this is happening just thought i should say something.
[QUOTE=Iamien;45684916]Going to preface by saying that These scripts are not completely original work, picked bits and pieces for other batch files out there. The following combination of one text file and two batch files will allow your server to: Update on (re)Start Restart on Crash and Restart after X second online. [URL="http://pastebin.com/MAyVkJ8s"]rust_ds.txt[/URL] - Place in same folder as steamcmd.exe [URL="http://pastebin.com/mJnrrs1A"]rustserver.bat[/URL] - Place in folder you want to contain your server save folder. Edit the Variables at the top with your exe locations and server options. [URL="http://pastebin.com/E09HpNys"]rustrestarter.bat[/URL] - Place in same folder as rustserver.bat Edit time variable with number of seconds you want to wait to restart. Default: 1 hour. Using these three components, all you have to do is run rustserver.bat and your server will stay online and up-to-date. If the server crashes, the re-starter is restarted as well, which resets the time delay. Close both cmd windows if you would like to turn off the server.[/QUOTE] Why do you need to restart every hour (or at all)? I thought the -autoupdate kills the server itself, hence allowing your script to just re-start it at that point?
[QUOTE=cukihsin;46161619]Why do you need to restart every hour (or at all)? I thought the -autoupdate kills the server itself, hence allowing your script to just re-start it at that point?[/QUOTE] I agree. What lines can I remove to prevent this from restarting the server every hour (or timed period)? I would prefer to restart if crashed or autoupdated. I think this will work: [CODE]cls echo Protecting RUST from crashes... title Rustdedicated server :rust // taskkill /f /im cmd.exe /fi "windowtitle eq rusttimerestart" start rustrestarter.bat %STEAMCMD% +runscript %STEAMSCRIPT% echo (%time%) rust started. start /wait %EXELOCATION% %EXEOPTIONS% echo (%time%) WARNING: rust closed or crashed, restarting. goto rust[/CODE]
[QUOTE=y0himba;46185137]I agree. What lines can I remove to prevent this from restarting the server every hour (or timed period)? I would prefer to restart if crashed or autoupdated.[/QUOTE] To tell you the truth, I decided not to use -autoupdate flag, because I tend to check a few times a day anyways and would prefer to give my clients a 5 min heads-up before I restart. If you still want to use OP's scripts, just make the time value be something ridiculous, instead of 3600 make it 3600000. Good luck!
I set it to 48 hours. :) Can't hurt with the -load flag specified...
Feel free to visit! client.connect armen.ddns.net:33053 </shameless_plug>
Incoming shameless plug! client.connect rust.y0himba.net We now return you to your regularly scheduled Rustafarianisms. :rock:
Wait, you can now define hostnames?! Just tried last night to no avail....
I set up my own DNS, and as long as you are using the default port, you are good to go.
[QUOTE=y0himba;46185285]I set up my own DNS, and as long as you are using the default port, you are good to go.[/QUOTE] Ok, edited my earlier post ;) (thanks man!)
SWEET! I will be on your server in a bit after I get crash/update protect on mine. It just updated itself to v1374, and didn't restart, so here i am trying to get this working :p [editline]8th October 2014[/editline] [QUOTE=Iamien;45688108]Using this I was the only available server period for about a half hour this morning.[/QUOTE] Where did you place the rustrestarter and rustserver batch files? I already have a save directory for my server...just not sure where in the path to drop them...
I created this batch file and run it every hour or so manually, even with the server running: @echo off steamcmd +runscript New_Rust.txt (Calls the New_Rust.txt file and starts the update) @echo off here are the contents of New_Rust.txt: login anonymous force_install_dir C:\RustServer\steamapps\common\rust_dedicated\Release app_update 258550 -beta experimental validate quit and here is my server start batch: @echo off start C:\RustServer\steamapps\common\rust_dedicated\release\Release\RustDedicated.exe -batchmode -load +server.hostname "US East - NO WIPES - Admins Active -armen.ddns.net" +server.maxplayers 250 +rcon.port 33054 +rcon.password "xxx"
[QUOTE=lewis3109;45703961]After downloading and modifying the bat files for my folders, running these makes a PING.EXE process go crazy for some reason, other wise with my simple bat start up no PING.EXE is running in task manager. do not know why this is happening just thought i should say something.[/QUOTE] Because the script is using the command line ping.exe included with windows to check the server status. [editline]8th October 2014[/editline] [QUOTE=cukihsin;46185398]I created this batch file and run it every hour or so manually, even with the server running: @echo off steamcmd +runscript New_Rust.txt (Calls the New_Rust.txt file and starts the update) @echo off here are the contents of New_Rust.txt: login anonymous force_install_dir C:\RustServer\steamapps\common\rust_dedicated\Release app_update 258550 -beta experimental validate quit and here is my server start batch: @echo off start C:\RustServer\steamapps\common\rust_dedicated\release\Release\RustDedicated.exe -batchmode -load +server.hostname "US East - NO WIPES - Admins Active -armen.ddns.net" +server.maxplayers 250 +rcon.port 33054 +rcon.password "xxx"[/QUOTE] My server autoupdates without issue, I would just like it to auto restart after the update. It will shut down, but not restart. I would prefer not to restart it on a timed schedule. I am thinking I can run it as a Windows service and set it to restart if stopped...?
I have tested the OP's scripts, and other than the annoying 3600s timer, it did properly recognize whenever RustDedicated.exe closed (via autoupdate or my manually quit'ing in server console) and restarted it automatically. Having said, I again stress to consider the experience of the folks on the server. Everyone is VERY appreciative when I give them some time to run back to the house, lock the door and be sure they have their keys copied and buried somewhere in the house :)
You are correct, of course. I wish there were a way to pass a say command to the server from a batch file, but not yet. If Rusty or any other RCON client starts working with experimental, that might help.
Rusty SOOOOOORTA works, but super-duper limited capacity still.
With the latest update all I get is invalid commands. Whatever happened to rcon.login?
Sorry, you need to Log In to post a reply to this thread.