专用服务器使用批处理文件

时间:2015-04-22 17:22:47

标签: windows batch-file cmd

我遇到了一些麻烦,希望有人可以提供帮助。我有一台游戏服务器,我在专用服务器上运行。我有一个当前正在运行服务器的批处理文件。服务器启动4小时后需要重新启动服务器。我正在努力的是让批处理文件在4小时内运行我的重启批处理文件的语句?如果批处理文件说在4小时内运行我的重启批处理,我的生命将被保存。

这是我当前的批处理文件。



@echo off
if "%configdone%"=="1" (
	GOTO :EOF
)
set configdone=0
set skbt_debug=2
set keepalive_database=1
set keepalive_bec=0
set keepalive_asm=0
set keepalive_ts=0
set keepalive_hc=0
set serverport=2302
set bindtoip=0
set serverip=118.217.115.72
set bec_flag_dsc=1
set teamspeak_port=2310
set asm_log_interval=5
set serverStartTimeout=10
set db_backup_interval=60
set use_zip_logs=1
set use_zip_backups=1
set databasebackupfolder="E:\Overpoch Server 1\Backup"
set logfilebackupfolder="C:\apps\epoch_log_backups"
set manual_timeout_length=2
set auto_timeout_length=10
set auto_restart_delay=5
set cleanWerDialogs=1
set hclaunchparams=-connect=1 -ip=199.217.115.72 -port=2312 -client -nosound -mod=@Epoch;@EpochHive;@MAS;
set armaserverexe=arma3server.exe
set hcexename=arma3serverHC.exe
set teamspeakfilename=ts3server_win64.exe
set redisexename=redis-server.exe
set becexename=bec.exe
set asmexename=ArmaServerMonitor.exe
set databasefile_name=dump.rdb
set asm_log_file=asm_performance.log
set armapath="C:\servers\epochServer"
set hcarmapath="C:\servers\epochServer"
set teamspeakpath="C:\apps\teamspeak"
set redispath="C:\servers\epochServer\DB"
set asmpath="C:\servers\epochServer"
set Battleyepath="C:\servers\epochServer\SC\BattlEye"
set LogPath="C:\servers\epochServer\SC"
set becpath="C:\servers\epochServer\BEC"
set databasefile="C:\servers\epochServer\DB\dump.rdb"
set servercfgpath="C:\servers\epochServer\SC\config.cfg"
set serverbasicpath="C:\servers\epochServer\SC\basic.cfg"
set profilepathname="SC"
set cli_username="SC"
if %bindtoip%==1 (
	set ip_param= -ip=%serverip%
) else (
	set ip_param=
)
set mod_string=-mod=@Epoch;@EpochHive;@MAS;
set servercommandline=%armaserverexe% "%mod_string:"=%" "-config=%servercfgpath:"=%" %ip_param% -port=%serverport% "-profiles=%profilepathname:"=%" "-cfg=%serverbasicpath:"=%" "-name=%cli_username:"=%" -autoinit
set serverAffinity=0,1,2,3,4,5,6,7
set becAffinity=0,1,2,3,4,5,6,7
set hcAffinity=0,1,2,3,4,5,6,7
set redisAffinity=2,3,4,5,6,7,0,1
set teamspeakAffinity=0,1,2,3,4,5,6,7
set asmAffinity=0,1,2,3,4,5,6,7
set serverPriority=normal
set becPriority=normal
set hcPriority=normal
set redisPriority=normal
set teamspeakPriority=normal
set asmPriority=normal




这是我的重启批次



@echo off
call "C:\servers\EPOCHS~2\batch\ULTSGS~1.CMD"
cd /D %armapath%
if %skbt_debug% GTR 2 (
	call :FUNC NOVAR BatchLogWrite 3__AUTO_RESTART__EVENT__INITIALIZE====================================
)
call batch_lib\lib\setauto.bat
call batch_lib\lib\stop_all.bat
goto :EOF

:FUNC
set currentDir=%CD%
cd "%armapath%/batch_lib/gbl_func"
rem %1 = return var, %2 = function, %3 = args
set returnvarname=%1
set funcname=%2
set argString=%3
set argString=%argString:__= %
set argString=%argString:"=%
set argString=%argString:(=[%
set argString=%argString:)=]%
set args=%argString%
if "%argString%"=="__=" set args=
if "%argString%"=="" (
	set args=
)
set filename=%funcname%.cmd
set val1=
for /f %%I in ('%filename% "%args%"') do (
	set "val1=%%I"
)
set "%1=%val1%"
cd %currentDir%
goto :EOF




感谢您的帮助! 杰森

1 个答案:

答案 0 :(得分:1)

什么是错的 - 等待4个小时然后重新启动。

timeout /t 14400
shutdown /r /f /t 0