forked from xerxes-at/T6ServerConfigs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWatchDog.bat
More file actions
33 lines (28 loc) · 1.19 KB
/
WatchDog.bat
File metadata and controls
33 lines (28 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
@echo off
::Name of the server's title
set name=Plutonium T6 Dedicated Server (r3208) - SERVER NAME GOES HERE AND ALSO EDIT (r3208) TO WHATEVER LASTEST
::Only change this when you don't want to keep the bat files in the game folder.
::MOST WON'T NEED TO EDIT THIS!
set gamepath=%cd%
::Time Rate to check if server is hung via game log
::https://superuser.com/questions/699769/batch-file-last-modification-time-with-seconds
::1800 - 30 mins
::1200 - 20 mins
::900 - 15 mins
::720 - 12 mins
set check_rate=900
::Server log location
set log_path=%localappdata%\Plutonium\storage\t6\logs
set log_file=games_mp.log
title PltuoT6 - %name% - Server watchdog
echo (%date%) - (%time%) %name% server watchdog start.
for /f "delims=" %%i in ('"forfiles /p "%log_path%" /m "%log_file%" /c "cmd /c echo @ftime" "') do set modif_time_temp=%%i
:Server
set modif_time=%modif_time_temp%
timeout /t %check_rate% /nobreak > nul
for /f "delims=" %%i in ('"forfiles /p "%log_path%" /m "%log_file%" /c "cmd /c echo @ftime" "') do set modif_time_temp=%%i
if "%modif_time_temp%" == "%modif_time%" (
echo "(%date%) - (%time%) WARNING: %name% server hung, killing server..."
taskkill /FI "WINDOWTITLE eq %name%" /F
)
goto Server