Considering the instability introduced by the latest game patch, I have encountered numerous problems while hosting my server. It unexpectedly crashes without any clear cause, and I have also heard similar complaints from other users. Следовательно, I have developed a quick batch script that automatically checks if the server is running and restarts it after a short delay of just 5 секунды.
Setting up the Script
If you are facing the same issues and wish to resolve them, the challenge lies in starting the server using a separate batch file, which makes it difficult to utilize Watchdog/Supervisor applications that handle such tasks. К счастью, I have devised a simple batch script that allows you to restart your server immediately after a crash, with the option to adjust the delay (“х”) as per your preference.
To configure an automatically restarting server, следуйте инструкциям ниже:
- Create a new .bat file in the directory of your server. You can name it anything since the specific name is not important.
- Copy and paste the following code into the file:
@echo off :A Set "MyProcess=PandemicServer.exe" set MAP=(ENTER MAP NAME HERE, CHECK FOR DEFAULTS BELOW) set PORT=(ENTER SERVER PORT HERE, CHECK FOR DEFAULTS BELOW) set QUERYPORT=(ENTER QUERY PORT HERE, CHECK FOR DEFAULTS BELOW) набор "SERVERNAME=(ENTER NAME OF YOUR SERVER HERE)" set MAXPLAYERS=(ENTER MAXIMUM AMOUNT OF PLAYERS HERE) заголовок "%MAP%" начинать "" WindowsServer/PandemicServer.exe %MAP% -log -servername="%SERVERNAME%" -SteamServerName="%SERVERNAME%" -port=%PORT% -queryport=%QUERYPORT% -maxplayers=%MAXPLAYERS% -force_steamclient_link goto B :B tasklist | find /i "%MyProcess%">nul || goto A TIMEOUT /T 5 goto B
- Save the file and execute it. It is crucial to adjust the values accordingly; в противном случае, your server will fail to start!
Значения по умолчанию:
MAP=Area12_PersistentLevel
PORT=7777
QUERYPORT=27015
The value
"SERVERNAME"
и
MAXPLAYERS
Наконец, if you wish to modify the interval at which the watchdog checks if the server is running or not, you can adjust the value as per your preference.
TIMEOUT /T x
(где “х” represents the desired number of seconds to wait), и сохраните файл.
Это все, чем мы делимся сегодня для этого. SCP: 5К гид. Это руководство было первоначально создано и написано [LOKE]YourC3PH. На случай, если нам не удастся обновить это руководство, вы можете найти последнее обновление, следуя этому связь.