[SERVER] Automatic Restart after Crash

Script Setup

If you've come here, you likely feel the same way, and that you would like to fix this. The issue is that, you have to start the server with a batch file in and of itself, making the usage of Watchdog/Supervisor applications that normally take care of such tasks very difficult. Luckily, I've devised a very simple batch script so that you may restart your server after x delay ("x" being adjustable if you like) immediately after a crash.

Follow the steps below in order to an automatically restarting server.

1: Create a new .bat file in your Server's directory. You can call it anything, as the name doesn't matter.

2: Paste in the following code:

@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%" start "" 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

3: Save the file, and start it. Make sure that you adjust the values however, otherwise YOUR SERVER WON'T START!

Default values:

MAP=Area12_PersistentLevel

PORT=7777

QUERYPORT=27015The value "SERVERNAME" and MAXPLAYERS I've set accordingly to my own required values. You may adjust these as you prefer.

Last but not least, if you'd like to change the interval between when the watchdog checks for whether the server or running is not, adjust the value TIMEOUT /T x (where "x" is the number of seconds to wait), and save the document.

Hope this guide helped!

Source: https://steamcommunity.com/sharedfiles/filedetails/?id=2993936034					

More SCP: Pandemic guilds