Hi everyone,
What is the best way to detect a DSGame-server.exe crash, record to log file, wait 5 seconds, force close and reopen (automated)? Thanks and sorry for the bother, I'm not great at coding/scripts.
Thanks in advance.
Server Question - Script to record log and then auto start s
-
- Posts: 15
- Joined: Mon Jan 15, 2018 10:02 am
Re: Server Question - Script to record log and then auto sta
Code: Select all
@echo off
cd ..
:onCrash
echo [%date% %time%] Restarting Server...
DSGame-server.exe --ip 127.0.0.1 --port 54230 --log .\log\Main_Map.log
echo Server was stopped or crashed!
GOTO onCrash
Save as .cmd file type, I keep mine in a folder named batch I tossed in the repository root so if you run it form elsewhere you will need to change that "cd .." line.
It is also possible to to run all your exe's out of just one cmd script with a few adjustments, google can help. I prefer mien separate so I can more easily manually restart 1 without the others being affected. There are 3rd party programs to restart things, but I feel that is overkill for such a trivial thing.
ps:
something like echo %date% %time%> .\log\Last_Main_Map_Stop.log just before the GOTO would record the last time a crash or restart happened, but you could also just look at the timestamp on the crashdump (you are saving crash dumps aren't you? that's automate-able to! see HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps in regedit and google)
Hi, I run The Demiurge server.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
DO NOT PRIVATE MESSAGE ME ABOUT BUGSPLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE