Bat File that will read the server file and then restart based on output of server file
NickName:user3255789 Ask DateTime:2014-01-31T21:31:06

Bat File that will read the server file and then restart based on output of server file

So far I've been trying to make a continuous .bat file that will start the server file, read every line that comes down and if the response "Server has become unresponsive" then the bat will close the file and re-open(this needs to be done every hour or so and I'm not always at the computer)

I do believe this is the correct code but I need to double check with some tech-savy minds to see if it's correct.

@echo off

SETLOCAL DisableDelayedExpansion

FOR /F "usebackq delims=" %%A in (`"findstr rust_server/n ^^ "`) do (
    set "myVar=%%A"
    call :processLine myVar
)
goto :eof

:processLine

SETLOCAL EnableDelayedExpansion
set "line=!%1!"
set "line=!line:*:=!"
echo(!line!

Find /I /V "Unresponsive for 10" 
taskkill /fi "WindowTitle eq rust_server*"
start /d "C:\Rust Server" rust_server.exe

ENDLOCAL
goto :eof

Any ideas/suggestions would be greatly appreciated.

Copyright Notice:Content Author:「user3255789」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/21481324/bat-file-that-will-read-the-server-file-and-then-restart-based-on-output-of-serv

More about “Bat File that will read the server file and then restart based on output of server file” related questions

Bat File that will read the server file and then restart based on output of server file

So far I've been trying to make a continuous .bat file that will start the server file, read every line that comes down and if the response "Server has become unresponsive" then the bat will close ...

Show Detail

restart node.js server from bat file

I'm trying to restart a node.js server without any thrid party library. The bat file is executed from the node server itself. Here is the restart.bat file: set processId=%1 taskkill /F /PID %proc...

Show Detail

How to run a .bat file on a node server?

I was wondering if you can perform an automatic restart of a server made with node. My idea was to run a .bat file via node that rebooted the server. It's possible to do it?

Show Detail

Restart Tomcat using bat file Windows

I have a Jenkins script which needs to restart the server after deploying the war file. the script has three steps %CATALINA_HOME%\bin\shutdown.bat && copy %JENKINS_HOME%\Project\Web.war %

Show Detail

how create a .bat file that deletes a file on remote server?

I am pretty new to .bat file concept. I have this daily admin task to remotely login on a server and delete the log file. I created a delete.bat file which deletes the desired log file but it works...

Show Detail

BAT: Parse Output File For Error Handling

I have a process that is kicked off by a scheduled batch file daily. I need to have error handling built in to restart the process if there is an error. All works great most days but I get a time out

Show Detail

Executing a Remote Bat File from A Remote Server

Want to do something like this but only returns the string of the scriptblock and no output. How would I get this bat file to execute and produce the desired output csv file? Invoke-Command -

Show Detail

Starting and stopping a minecraft server ran by a bat file using a discord bot

I am using a locally hosted minecraft server for me and few friends to play on. I have been experimenting using a discord bot to listen for a command and then run the bat file starting the server. ...

Show Detail

How to execute a bat file on remote server?

I have two physical machine. The first machine want to execute a bat file on the second machine. I create a share location on the second server and tried to run it from the first machine and it doe...

Show Detail

How to call bat file using jsp where bat file is located on server

How do I call a .bat file using JSP where the .bat file is located on the web server. I have already tried to run the .bat file using the web application. Suggestions welcome.

Show Detail