Server Online Checker

Newbie Spellweaver
Joined
Aug 31, 2009
Messages
29
Reaction score
4
Well I made a little batch file script that checks whether your server is online, if it isn't it will open it for you. Kinda like a server re-starter I guess.

Really all this does is checks if java.exe is open in your tasklist and if it isn't it will open your server, so hopefully you don't have any other program with java.exe in there which would stop the program from working properly.

Here's the script, copy and paste it to notepad and save into your server folder with the file extension .bat

PHP:
::Server Online Checker [SOC]
::Created by Slizard

@echo off
@title Server Online Checker
:MAIN
tasklist /FI "IMAGENAME eq java.exe" 2>NUL | find /I /N "java.exe">NUL
if "%ERRORLEVEL%"=="1" goto Server_Offline

:Server_Online
echo [Date:%date%] [Time:%time%] - Server is online.
goto END

:Server_Offline
echo [Date:%date%] [Time:%time%] - Server is offline, starting now...
start "STARTER.bat"
goto END

:END
ping -n 20 localhost > nul
goto MAIN

*Remember to change "STARTER.bat" to what your server launcher is called.

Hope that this is useful to some people.

EDIT: If your too lazy to copy and paste or don't know how to here is a download link
Code:
http://www.mediafire.com/?ztonwm0wnqm
 
Last edited:
Thanks guys.

@wietse02
Yeah, if your using an Odin based source. It should have java.exe in your tasklist because it is java.

@Faint
Yea I tested it, it does work.

@FruityJohn
Well what don't you get? Copy and paste the script into a new notepad document.
Save it in your server folder and make sure the file name has .bat at the end, so like SOC.bat or something. If you really don't get it here is a download .

Also the part about renaming STARTER.bat, right click the .bat file and click edit. Then find where it says "STARTER.bat" change that to whatever you use to start your server, if you use like XiuzSource you would rename that to "[XiuzSource] Launcher.bat"
 
Thanks guys.

@wietse02
Yeah, if your using an Odin based source. It should have java.exe in your tasklist because it is java.

@Faint
Yea I tested it, it does work.

@FruityJohn
Well what don't you get? Copy and paste the script into a new notepad document.
Save it in your server folder and make sure the file name has .bat at the end, so like SOC.bat or something. If you really don't get it here is a download .

Also the part about renaming STARTER.bat, right click the .bat file and click edit. Then find where it says "STARTER.bat" change that to whatever you use to start your server, if you use like XiuzSource you would rename that to "[XiuzSource] Launcher.bat"

Im using the Pack rev 76 and when I right click and clicked edit. It didnt show Starter.bat
 
so if java.exe is not in the tasklist, it turns the server online?
That's stupid since there are other applications that use java.exe .

Nice try though.

Yeah I know, I don't know to to make it so that it would read the window name instead of the .exe name.
 
Yeah I know, I don't know to to make it so that it would read the window name instead of the .exe name.

Shouldn't you also make it close starter.bat before you run it again? I don't know much about crashes, as I haven't had one in a long time but I am fairly sure you just get a decent amount of bat errors...

And would it not be possible to change the name of the process? It depends on the name of the file (java.exe process name is java.exe) so... unless anything looks for java.exe then you can simply rename it?
 
Last edited:
Shouldn't you also make it close starter.bat before you run it again? I don't know much about crashes, as I haven't had one in a long time but I am fairly sure you just get a decent amount of bat errors...

And would it not be possible to change the name of the process? It depends on the name of the file (java.exe process name is java.exe) so... unless anything looks for java.exe then you can simply rename it?

If you want it to close the starter.bat before opening add this command:
PHP:
taskkill /im starter.bat
Probably in front of:
PHP:
start starter.bat

And do you mean change the java.exe process name to something else?
 
Back