Hi we wanted to be able to copy server log files after a crash before server auto restarted.
Our problem was our servers run on a dedibox via TCADMIN which is great for auto starts but as their is no method via game config to rename files they are over written and lost.
What we have done is disabled TCADMIN and run our servers via a batch file, which monitors the servers via netstat.
If server crashes - the bat file will copy the log and rename it with date and time stamp and then restart the server.
the code for the bat file is:
@Echo Off :TOP echo Starting MOHAA SERVER at %time% on %date% C: rem ********* path of server CD \xxgames\JOHNB\GameServers\TC53876308814267318465148\ rem ********* server command line start rem change path and ip of server xx.xx.xx.xx start /wait MOHAA_server.exe C:\xxgames\JOHNB\GameServers\TC53876308814267318465148\MOHAA_server.exe +set developer 0 +set dedicated 1 +set ui_console 1 +set sv_maxclients 32 +set net_ip xx.xx.xx.xx +set net_port 12209 +exec server.cfg rem ********** short delay timeout 5 Rem ********* copy existing log to new directory copy "C:\xxgames\JOHNB\GameServers\TC53876308814267318465148\main\qconsole.log" "C:\xxgames\JOHNB\GameServers\TC53876308814267318465148\crashlogs" cd C:\xxgames\JOHNB\GameServers\TC53876308814267318465148\crashlogs rem ******** short delay - increase if required timeout 5 rem ****** date and time no changes required @echo off for /F "tokens=2-4 delims=/ " %%i in ('date /t') do set yyyymmdd=%%k%%i%%j echo Date: %yyyymmdd% for /F "tokens=1-2 delims=: " %%l in ('time /t') do set hhmm=%%l%%m echo Time: %hhmm% rem -- or use both echo %yyyymmdd%%hhmm% rem ******* rename copy of log to date time stamp REN C:\xxgames\JOHNB\GameServers\TC53876308814267318465148\crashlogs\qconsole.log pl%yyyymmdd%%hhmm%.txt echo. echo T - 15 rem******** mohaa server port check for running netstat -a | find "12209">nul echo. echo. goto TOP
Just create a bat file and past this in changing path names, IP and ports