Restart script

Ask questions about dedicated servers here and we and other users will do our best to answer them. Please also refer to the self-help section for tutorials and answers to the most commonly asked questions.
Post Reply
wtfaatp
New to forums
New to forums
Posts: 12
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Thu Feb 09, 2012 9:36 pm

Restart script

Post by wtfaatp »

I am trying to use a restart script for my server.

Code: Select all

set servername=Gungame Server #1
set runcmd=C:\Windows\System32\cmd.exe /c start /high /d"c:\game_installs\gg\css" "Game server" "c:\game_installs\gg\css\srcds.exe" -game cstrike -ip *** -port 27015 -maxplayers 20 -console -nocrashdialog
@echo off
title %servername%

cls

echo.
echo.
echo *************************************************************************
echo To close the server, close this window and type exit in the server window
echo *************************************************************************
echo.
echo.
echo %servername% is now starting...
>> "%servername%.log" echo.
>> "%servername%.log" echo.
>> "%servername%.log" echo (%date%)(%time%)
>> "%servername%.log" echo (%date%)(%time%) %servername% is now starting...

:restart

echo.
echo (%date%)(%time%) %servername% is now ONLINE
echo Watching %servername% for crashes...
>> "%servername%.log" echo.
>> "%servername%.log" echo (%date%)(%time%) %servername% is now ONLINE
>> "%servername%.log" echo (%date%)(%time%) Watching %servername% for crashes...

::Start the actual server
start /wait %runcmd%

echo.
echo (%date%)(%time%) Crash or Close detected!
echo %servername% is now restarting...
>> "%servername%.log" echo.
>> "%servername%.log" echo (%date%)(%time%) Crash or Close detected!
>> "%servername%.log" echo (%date%)(%time%) %servername% is now restarting...

goto restart
The problem is that it create's infinite amounts of game server consoles :\

Anyone help to fix this goof?
> NFO rocks. love you guys!
> NEVER GO ANYWERE! Thats an order..
> You have to try and give the customer what they want right?
> WELL I WANT YOU TO STAY HERE
> :D AWESOME SERVERS, AWESOME TECH SUPPORT..
> Thank you guys so much :D
User avatar
Edge100x
Founder
Founder
Posts: 13113
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Restart script

Post by Edge100x »

You would need to change your "startcmd" to remove the "C:\Windows\System32\cmd.exe /c start" bit, which is launching the server in the background.

I also recommend running the server as a system service, either using Firedaemon or another tool such as NSSM.
Post Reply