Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :Original at http://pastebin.com/BRUbsGQh
- @ECHO OFF
- set programname=SteamCMD Guardian 1.3
- set LOGFILE=steamguardian.log
- set SEARCHTEXT="
- set REPLACETEXT='
- set steamcmdinstall=null
- set app=
- set game=
- GOTO MAINPROG
- :FAILRUNNOSTEAMCMD
- ECHO Steamcmd install path of %steamcmdinstall% provided no found!
- >> %LOGFILE% ECHO Steamcmd install path of %steamcmdinstall% provided no found!
- GOTO END
- :END
- pause
- exit
- ::===========================================::
- :: SteamCMD Guardian 1.3 WildCard65's Edition::
- :: WildCard65 ::
- ::===========================================::
- :MAINPROG
- if "%~1"=="" (
- GOTO NOTICE
- ) ELSE GOTO MAIN
- :NOTICE
- ECHO This edition of steam guardian is modified to allow command line parameters:
- ECHO -steamcmdinstall <path to steamcmd, can be blank if you have steamcmd path in your PATH environment variable(default is no specified path)>
- ECHO -maindir <main dir where all servers installed by this script go>
- ECHO -runscript <script for steamcmd to run>
- ECHO -servername <name of the server your going to run off of this script here>
- ECHO -game <THIS MUST BE EXACT FOR THE GAME BECAUSE IT'LL BE SUPPLIED TO SRCDS.EXE -game PARAMETER. EX: -game tf>
- ECHO -installdir <name of folder the server will be installed in>
- ECHO -srcdsparameters <parameters to pass to srcds.exe
- pause
- GOTO END
- :MAIN
- :loop
- IF NOT "%1"=="" (
- IF "%1"=="-steamcmdinstall" (
- SET steamcmdinstall=%2
- SHIFT
- )
- IF "%1"=="-maindir" (
- SET maindir=%~2
- SHIFT
- )
- IF "%1"=="-servername" (
- SET servername=%~2
- SHIFT
- )
- IF "%1"=="-runscript" (
- SET runscript=%2
- SHIFT
- )
- IF "%1"=="-game" (
- SET game=%2
- SHIFT
- )
- IF "%1"=="-installdir" (
- SET installdir=%2
- SHIFT
- )
- IF "%1"=="-srcdsparameters" (
- SET srcdsparameters=%~2
- SHIFT
- )
- SHIFT
- GOTO :loop
- )
- title %programname% - %servername%
- IF NOT %steamcmdinstall%==null (
- IF EXIST %steamcmdinstall% (
- CD %steamcmdinstall%
- GOTO BEGINSTEAMGUARDIAN
- ) ELSE GOTO FAILRUNNOSTEAMCMD
- )
- :BEGINSTEAMGUARDIAN
- ECHO %programname% has been started!
- >> %LOGFILE% ECHO %programname% has been started!
- REM IF %game%=="1" set app=90
- REM IF "%A%"=="2" set app=740
- REM IF "%A%"=="3" set app=111710
- REM IF "%A%"=="4" set app=223240
- REM IF "%A%"=="5" set app=212542
- REM IF "%A%"=="6" set app=215350
- IF %game%=="tf" set app=229830
- :RESTART
- IF EXIST "%maindir%\%installdir%\srcds.exe" (
- ECHO %servername% is now ONLINE
- ECHO Watching %servername% for crashes...
- >> %LOGFILE% ECHO %servername% is now ONLINE
- >> %LOGFILE% ECHO Watching %servername% for crashes...
- CD "%maindir%\%installdir%\"
- start /wait srcds.exe %srcdsparameters%
- ) ELSE (
- ECHO Server not installed!
- >> %LOGFILE% ECHO Server not installed!
- )
- ::Start the actual update window
- CD %steamcmdinstall%
- start /wait steamcmd +runscript %runscript%
- ECHO (%time%) WARNING: srcds closed or crashed, restarting.
- ECHO (%date%)(%time%) Crash or Close detected!
- ECHO %servername% is now restarting...
- >> %LOGFILE% ECHO (%time%) WARNING: srcds closed or crashed, restarting.
- >> %LOGFILE% ECHO (%date%)(%time%) Crash or Close detected!
- >> %LOGFILE% 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement