For those of you who have not used SRCDS Guardian before, it's a windows batch script made to restart the server if it is shut down. It was first built by Black-Sky & Drocona. I then released an edited version with some basic customizations. However, editing the script with the customizations required searching through and replacing a lot of things.
SRCDS Guardian 2.0 does away with this by setting variables at the start of the script to make everything easier. Below is the script. I've also added it in a zip file. (Since we can't add .bat files)
::=========================================================::
:: Thanks To Black-Sky & Drocona for making SRCDS Guardian ::
:: This script is open source. Feel free to edit at will. ::
:: ::
:: This script was writen for the use of the srcds.com ::
:: online community. If you are interested in running a ::
:: Source Dedicated Server or need help, drop by our ::
:: forums at... http://forums.srcds.com ::
::=========================================================::
:: This will keep the window clean and easy to read
@echo off
::=======================::
:: SET YOUR VARIABLES! ::
::=======================::
::=======================::
:: Window and Log name ::
:: Replace "My Server" ::
::=======================::
set servername="My server"
:: Sets the title of the window
title SRCDS Guardian 2.0 %servername%
:: Clears the window incase there is anything there
cls
:: Prints to the window what we are doing
echo SRCDS Guardian 2.0 has been started!
echo.
echo **************************************************************************
echo To close the server, close this windows and type exit in the server window
echo **************************************************************************
echo.
echo.
>> %servername%_Guardian.log echo.
>> %servername%_Guardian.log echo (%date%)(%time%) SRCDS Guardian 2.0 has been started!
echo (%date%)(%time%) %servername% is now starting...
>> %servername%_Guardian.log echo (%date%)(%time%) %servername% is now starting...
:: This is a return point in case the server crashes or is closed
:restart
echo (%date%)(%time%) %servername% is now online
>> %servername%_Guardian.log echo (%date%)(%time%) %servername% is now online
echo Watching %servername% for crashes...
>> %servername%_Guardian.log echo (%date%)(%time%) Watching %servername% for crashes...
::Start the actual server
start /wait %runcmd%
echo (%date%)(%time%) Crash or Close detected!
>> %servername%_Guardian.log echo (%date%)(%time%) Crash or Close detected!
echo (%date%)(%time%) %servername% is now restarting...
>> %servername%_Guardian.log echo (%date%)(%time%) %servername% is now restarting...
::Server crashed or closed, so we point it to the return point to start the server again
goto restart
~ Mooga ...w00t? - SRCDS.com on Twitter Please do not PM me for server related help
fqdn Wrote:if you've seen the any of the matrix movies, a game server is not all that different. it runs a version of the game that handles the entire world for each client connected.
that's the 2 sentence explanation.
(This post was last modified: 02-17-2010 04:58 AM by Mooga.)
09-04-2008 09:52 AM
Ghost Assassin
Regular Member
Posts: 131
Joined: Mar 2008
Reputation: 0
Would it be possible to run multiple servers using this batch file? If yes, how do you set it up? Just wondering...I tried experimenting with the other SRCDS Guardian.
Earn Points, get Free Rewards with your Amazon Points! Points2Shop
Just have one batch files per server.
Set the server name and command line. All my servers use SRCDS Guardian. With HL servers, make sure the batch file is in the game folder
~ Mooga ...w00t? - SRCDS.com on Twitter Please do not PM me for server related help
fqdn Wrote:if you've seen the any of the matrix movies, a game server is not all that different. it runs a version of the game that handles the entire world for each client connected.
that's the 2 sentence explanation.
09-04-2008 02:44 PM
Drocona
Forum admin
Posts: 5,167
Joined: Mar 2005
Reputation: 20
Ghost Assassin, you could make one "master" batch file that executes all the specific server batch files. So when you execute the master batch file all your servers will start up.
You have to have a user logged in to the box running the batch file though. And if you run it as a service, I don't think killing the service will close the srcds processes. You could use something like this instead. You don't need someone logged into the box (saves RAM).
The batch file is nicely written
A+
(This post was last modified: 11-01-2008 07:25 PM by recon0.)
Hey I got this working but have one problem, I run servers on different cores of the system and when SRCDS Guardian reboots the server it defaults to all cores. Any one to make it default to s specific core?
Jim
CEO
Co-Founder
Veloci Servers
¤ø„¸¨°º¤ø„¸ ¸„ø¤º°¨¸„ø¤º°¨
¨°º¤ø„¸ Hardstyle ¸„ø¤º°¨
¸„ø¤º°¨ Q Dance ``°º¤øFrom Ireland
In you are using window server, you can use the affinity command. For XP (or vista) you would need to install a third part program (to my knowledge)
~ Mooga ...w00t? - SRCDS.com on Twitter Please do not PM me for server related help
fqdn Wrote:if you've seen the any of the matrix movies, a game server is not all that different. it runs a version of the game that handles the entire world for each client connected.
that's the 2 sentence explanation.
01-09-2009 06:14 PM
realchamp
I didn't make this post -->
Posts: 5,541
Joined: May 2008
Reputation: 54
::=========================================================::
:: Tak til Black-Sky & Drocona for at lave SRCDS Guardian ::
:: Dansk oversættelse er oversat af realchamp ::
:: Dette script er en open source. ::
:: Du er velkommen til at redigere efter behag ::
:: ::
:: Dette script blev skrevet til brug for srcds.com ::
:: online samfund. Hvis du er interesseret i at køre en - ::
:: Source Dedicated Server eller mangler hjælp, så smut - ::
:: forbi vores på ... http://forums.srcds.com ::
::=========================================================::
:: Dette vil køre kommando prompten's vindue rent og nemt at læse
@echo off
::=======================::
:: SÆT DINE VARIABLER! ::
::=======================::
::=======================::
:: Vindue og log navn ::
:: Skift "Min Server" ::
::=======================::
set servername="Min Server"
:: Dette vil give vinduet en titel
title SRCDS Guardian 2.0 %servername%
:: Rydder vinduet i et tilfælde at der er skulle være noget
cls
:: Skriver i vinduet hvad vi laver
echo SRCDS Guardian 2.0 er nu startet!
echo.
echo **********************************************************************
echo For at lukke serveren, luk dette vindue og skriv exit i server vinduet
echo **********************************************************************
echo.
echo.
>> %servername%_Guardian.log echo.
>> %servername%_Guardian.log echo (%date%)(%time%) SRCDS Guardian 2.0 er nu startet!
echo (%date%)(%time%) %servername% starter nu op...
>> %servername%_Guardian.log echo (%date%)(%time%) %servername% starter nu op...
:: Dette er en tilbagevenden punkt i tilfælde af, at serveren går ned eller er blevet lukket ned
:restart
echo (%date%)(%time%) %servername% er nu online
>> %servername%_Guardian.log echo (%date%)(%time%) %servername% er nu online
echo Overvåger nu %servername% for nedbrud...
>> %servername%_Guardian.log echo (%date%)(%time%) Overvåger nu %servername% for nedbrud...
:: Start selve serveren
start /wait %runcmd%
echo (%date%)(%time%) Nedbrud eller nedlukning opdaget!
>> %servername%_Guardian.log echo (%date%)(%time%) Nedbrud eller nedlukning opdaget!
Vista's start command (atleast biz ver) lets you set affinity via a commandline switch. Both OS's will let you set process priority via a switch as well.
Manage your redirects/fast downloads with one click! SourceRSC and HL1RSC FPSbooster as a windows service. Free and with source.
Need a free web based game server control panel? Check out UGCC.
i'm a little confused here, i tried moving my steam folder to different places to get this to work, but it keeps saying "cannont find C:\Steam\steamapps\myusername\source" when the whole folder is C:\steam\steamapps\mysuername\source dedicated server\srcds.exe. I'm trying to get this for hl2dm. can someone please help!!!!
My Batch File looks like this: (I did change the directory)