Como reiniciar automaticamente o servidor privado quando ele travar no SCP: 5k

Então, considering how unstable the latest patch has made the game, I’ve encountered numerous issues with hosting my server. It crashes for no apparent reason, and I’ve heard similar complaints from others as well. Como resultado, I’ve decided to create a quick batch script that automatically checks if the server is running and, se não, restarts it after just 5 segundos.

Script Setup:

If you’re facing the same problem, and you want to fix it, there’s an issue with starting the server using a batch file, which makes it difficult to use Watchdog/Supervisor applications that usually handle such tasks. Felizmente, I’ve come up with a simple batch script that allows you to restart your server after a certain delay (“x”), which you can adjust as needed, immediately after a crash.

Follow the steps below to set up an automatically restarting server:

  1. Create a new .bat file in your server’s directory. You can name it anything you like; the name doesn’t matter.
  2. Copie e cole o seguinte código:
@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)
set "SERVERNAME=(ENTER NAME OF YOUR SERVER HERE)"
set MAXPLAYERS=(ENTER MAXIMUM AMOUNT OF PLAYERS HERE)

title "%MAP%"
começar "" 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
  1. Save the file and start it. Make sure to adjust the values accordingly; por outro lado, YOUR SERVER WON’T START!

Default values:

MAP = Area12_PersistentLevel
PORT = 7777
QUERYPORT = 27015

The value

"SERVERNAME"

e

MAXPLAYERS

I’ve set it according to my own required values. You can adjust these as you prefer.

Por último, mas não menos importante, if you’d like to change the interval at which the watchdog checks whether the server is running or not, adjust the value.

TIMEOUT /T x

(onde “x” is the number of seconds to wait), and save the file.

Este guia sobre SCP: 5k Foi escrito por [LOKE]YourC3PH. Você pode visitar a publicação original neste link. Se você tiver alguma dúvida sobre este guia, por favor, não hesite em contactar-nos aqui.

Sobre o autor