mirror of
https://github.com/ineedbots/t4_bot_warfare.git
synced 2025-04-20 23:25:42 +00:00
more scripts
This commit is contained in:
parent
b62734298b
commit
b17bdec320
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,6 +8,8 @@
|
|||||||
!/.gitattributes
|
!/.gitattributes
|
||||||
|
|
||||||
!/z_server.bat
|
!/z_server.bat
|
||||||
|
!/z_server_updater.bat
|
||||||
|
!/z_server_watchdog.bat
|
||||||
!/z_server_wine.sh
|
!/z_server_wine.sh
|
||||||
!/README.md
|
!/README.md
|
||||||
!/out
|
!/out
|
||||||
|
@ -13,10 +13,13 @@ set port=28968
|
|||||||
set ip=0.0.0.0
|
set ip=0.0.0.0
|
||||||
::Mod name (default "")
|
::Mod name (default "")
|
||||||
set mod=
|
set mod=
|
||||||
::Only change this when you don't want to keep the bat files in the game folder. MOST WON'T NEED TO EDIT THIS!
|
:: current dir of this .bat file
|
||||||
set gamepath=%cd%
|
SET mypath=%~dp0
|
||||||
|
SET mypath=%mypath:~0,-1%
|
||||||
|
::Only change this when you don't want to keep the bat files in the game folder. MOST WON'T NEED TO EDIT THIS! %cd%
|
||||||
|
set gamepath=%mypath%
|
||||||
::Your plutonium install path (leave default!)
|
::Your plutonium install path (leave default!)
|
||||||
set pluto_path=%LOCALAPPDATA%\Plutonium
|
set pluto_path=%gamepath%\Plutonium
|
||||||
:: Gamemode; oneof t4sp, t4mp, t5sp, t5mp, iw5mp, t6mp, t6zm
|
:: Gamemode; oneof t4sp, t4mp, t5sp, t5mp, iw5mp, t6mp, t6zm
|
||||||
set pluto_game_mode=t4mp
|
set pluto_game_mode=t4mp
|
||||||
:: Other things to send to cmd
|
:: Other things to send to cmd
|
||||||
|
12
z_server_updater.bat
Normal file
12
z_server_updater.bat
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
@echo off
|
||||||
|
:: current dir of this .bat file
|
||||||
|
SET mypath=%~dp0
|
||||||
|
SET mypath=%mypath:~0,-1%
|
||||||
|
|
||||||
|
:: %cd%
|
||||||
|
set gamepath=%mypath%
|
||||||
|
|
||||||
|
:: %LOCALAPPDATA%\Plutonium
|
||||||
|
set pluto_path=%gamepath%\Plutonium
|
||||||
|
|
||||||
|
"%gamepath%\plutonium.exe" -install-dir "%pluto_path%" -update-only
|
43
z_server_watchdog.bat
Normal file
43
z_server_watchdog.bat
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
@echo off
|
||||||
|
::Name
|
||||||
|
set name=PT4MP Bot Warfare Server Watchdog
|
||||||
|
::Exe of the server
|
||||||
|
set server_exe=plutonium-bootstrapper-win32.exe
|
||||||
|
::The regex search for the window name of the server Windows 11 reports "N/A" as window name?? or is it Windows terminal??
|
||||||
|
set server_title_regex=Plutonium r.*
|
||||||
|
:: current dir of this .bat file
|
||||||
|
SET mypath=%~dp0
|
||||||
|
SET mypath=%mypath:~0,-1%
|
||||||
|
::Only change this when you don't want to keep the bat files in the game folder. MOST WON'T NEED TO EDIT THIS! %cd%
|
||||||
|
set gamepath=%mypath%
|
||||||
|
::Rate to check if server is hung
|
||||||
|
set check_rate=300
|
||||||
|
::Server log location
|
||||||
|
set log_path=%gamepath%\Plutonium\storage\t4\main
|
||||||
|
set log_file=games_mp.log
|
||||||
|
|
||||||
|
title Plutonium - %name% - Server watchdog
|
||||||
|
echo Visit plutonium.pw / Join the Discord (a6JM2Tv) for NEWS and Updates!
|
||||||
|
echo (%date%) - (%time%) %name% server watchdog start.
|
||||||
|
|
||||||
|
::https://superuser.com/questions/699769/batch-file-last-modification-time-with-seconds
|
||||||
|
dir "%log_path%"\"%log_file%" > nul
|
||||||
|
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
|
||||||
|
|
||||||
|
dir "%log_path%"\"%log_file%" > 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..."
|
||||||
|
::https://stackoverflow.com/questions/26552368/windows-batch-file-taskkill-if-window-title-contains-text
|
||||||
|
for /f "tokens=2 delims=," %%a in ('
|
||||||
|
tasklist /fi "imagename eq %server_exe%" /v /fo:csv /nh
|
||||||
|
^| findstr /r /c:"%server_title_regex%"
|
||||||
|
') do taskkill /pid %%a /f
|
||||||
|
)
|
||||||
|
goto Server
|
@ -21,7 +21,23 @@ export WINE_LOCATION="/home/deck/.var/app/net.lutris.Lutris/data/lutris/runners/
|
|||||||
|
|
||||||
# which bat to execute
|
# which bat to execute
|
||||||
export SERVER_BAT_LOCATION="./z_server.bat"
|
export SERVER_BAT_LOCATION="./z_server.bat"
|
||||||
|
export SERVER_UPDATER_BAT_LOCATION="./z_server_updater.bat"
|
||||||
|
export SERVER_WATCHDOG_BAT_LOCATION="./z_server_watchdog.bat"
|
||||||
|
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
server) export BAT_LOCATION=$SERVER_BAT_LOCATION
|
||||||
|
;;
|
||||||
|
update) export BAT_LOCATION=$SERVER_UPDATER_BAT_LOCATION
|
||||||
|
;;
|
||||||
|
watchdog) export BAT_LOCATION=$SERVER_WATCHDOG_BAT_LOCATION
|
||||||
|
;;
|
||||||
|
*) export BAT_LOCATION=$SERVER_BAT_LOCATION
|
||||||
|
me=`basename "$0"`
|
||||||
|
echo "Usage: $me (server|update|watchdog)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
# exec it
|
# exec it
|
||||||
$WINE_LOCATION $SERVER_BAT_LOCATION
|
$WINE_LOCATION $BAT_LOCATION
|
||||||
|
Loading…
x
Reference in New Issue
Block a user