Come riavviare automaticamente il server privato quando si blocca in SCP: 5K

Così, 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. Di conseguenza, I’ve decided to create a quick batch script that automatically checks if the server is running and, altrimenti, restarts it after just 5 secondi.

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. per fortuna, 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. Copia e incolla il seguente codice:
@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)

titolo "%MAP%"
inizio "" 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; altrimenti, 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.

Ultimo, ma non per importanza, 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

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

Questa guida su SCP: 5K è stato scritto da [LOKE]YourC3PH. Puoi visitare la pubblicazione originale da questo collegamento. In caso di dubbi su questa guida, per favore non esitate a contattarci qui.

Circa l'autore