|
Answer» I have a game server that that's launched from a .bat file.
I used task scheduler to set the computer to restart every morning at 0500, and then LAUNCH the .bat at startup.
This is where my problem begins.
when I manually launch the server via double clicking the .bat, it opens CMD and runs as intended.
When the task scheduler event runs and launches the server, it works... but it's running in the background and I have no way to see what it's doing. If something goes wrong, I can't tell without opening perfmon and looking at my system's resource consumption.
Thats problem 1.
Problem 2 is if my server crashes or closes, it stays off until I either notice, or 0500 rolls around.
I THOUGHT to ADD "goto START" at the end... but that just causes the server to launch over and over until the entire system bogs down and becomes unresponsive
ANY assistance would be greatly appreciated!
Heres a copy of my .bat:
:Backup echo off echo Waiting for backup to Start! /t 10 sec timeout /t 10 echo Thanks for waiting title Atlas Server Batch Backup Started! For /f "tokens=1-3 delims=//" %%a in ('date /t') do (set mydate=%%c-%%a-%%b) For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b) xcopy /s "D:\AtlasSrv\ShooterGame\Saved" "D:\ServBackups\Atlas\%mydate%_%mytime%\" echo Backup created! echo off echo backup Completed! /t 10 sec timeout /t 10 echo Thanks for waiting! goto :UPDATE :UPDATE echo Starting game update! echo %time%: Starting game update>>restartlog.txt cd %steamcmd_path% start D:\AtlasSrv\SteamCMD\steamcmd.exe +login anonymous +force_install_dir D:\AtlasSrv\ +app_update 1006030 validate +quit goto :WAITFORUPDATE :WAITFORUPDATE echo off echo Waiting for update to finish! /t 1000 sec timeout /t 1000 echo Thanks for waiting.. Starting Server in 10 sec! timeout /t 10 goto :START :START start D:\AtlasSrv\ShooterGame\Binaries\Win64\ShooterGameServer.exe BLACKWOOD?ServerX=0?ServerY=0?AltSaveDirectoryName=10?ServerAdminPassword=*********?MaxPlayers=50?ReservedPlayerSlots=25?QueryPort=57582?Port=5761? -log -server -NoBattlEye -NoSeamlessServer Two things to try
1. When you schedule the task, if you set it to run as the user that will be logged in at the time, it should run in the foreground. There is also a "Hidden" checkbox under the general tab. Ensure that is unchecked.
2. In the Scheduled Task properties, under the 'Actions' tab, choose your action and click edit. Under the program/script field, change this to
cmd
Under the add arguments field, change this to
/k "C:\path\to\job.bat"
Modifying it to your actual batch drive, path, and name of course!
|