[Guide] Start Server.bat

Results 1 to 8 of 8
  1. #1
    Newbie JBurrke is offline
    MemberRank
    Feb 2010 Join Date
    5Posts

    [Guide] Start Server.bat

    Hey everyone.. First post here, thought I'd share a simple batch file that I've created to start your server quickly and painlessly.. Obviously this wont be helpful to people who are experienced scripters (most of you ).. Anyways, here we go

    So the goal is to start all of the server programs with one double click of an executable. This is a pretty simple task, but the tricky part is making sure you get them in order. Because the batch file runs through it's commands so quickly, sometimes it will try to open the next .exe before the last one has a chance to open, and this will cause problems with starting your server.

    The trick to doing this is implementing a pause between commands, so that you give the executable time to open up completely before opening up the next. In previous versions of windows, this was done easily by using different commands, one of which was actually "WAIT". Now, the only way I know of doing this is tricking the batch file into pinging a non existent ip, and it will cause a slight delay. So to start with, open up notepad (start > run > notepad.exe) and copy / paste this:

    Code:
    @ping 127.0.0.1 -n 2 -w 1000 > nul
    @ping 127.0.0.1 -n %1% -w 1000> nul
    This is what you're using to create the delay, we'll call for this file later on when we're creating the actual batch file that will start your server. File > save as > save as type "All Files". Save it as "wait.bat"

    Next, open another instance of notepad.

    This is going to be the actual program that will run our server files. The syntax to run an exe is as follows:

    Code:
    start "Name of whatever" "Location of exe"
    The part that says name of whatever doesnt really matter, but you have to put it because the first file we're going to open will be in the same directory as this file. If you werent to put this, multiple instances of command prompt would open and your server wouldn't run. Anyways, heres the full code that will go in this file:

    Code:
    @echo off
    start "Account Server" "D:\Documents and Settings\Administrator\Desktop\Server Files\Program\1.AccountServer.exe"
    call wait 1
    start "Database Server" "D:\Documents and Settings\Administrator\Desktop\Server Files\Resource\2.DatabaseServer.exe"
    call wait 1
    start "Core Server" "D:\Documents and Settings\Administrator\Desktop\Server Files\Program\3.CoreServer.exe"
    call wait 1
    start "Certifier" "D:\Documents and Settings\Administrator\Desktop\Server Files\Program\4.Certifier.exe"
    call wait 1
    start "Login Server" "D:\Documents and Settings\Administrator\Desktop\Server Files\Program\5.LoginServer.exe"
    call wait 1
    start "Cache Server" "D:\Documents and Settings\Administrator\Desktop\Server Files\Program\6.CacheServer.exe"
    call wait 1
    start "World Server" "D:\Documents and Settings\Administrator\Desktop\Server Files\Resource\WorldServer.exe_fixed.exe"
    exit
    Now, to explain this a little better..
    Each line is using the syntax I explained earlier to run a specific program. In this example, it's running each program to start the server in the order that I learned how to run them. The problem is, the commands would run so quickly that it would open one before it opened the previous, so the server wouldn't start up correctly.

    This is why we use the call command. What that's doing is calling the wait.bat file we created earlier to initialize the pause we created by using a fake ping.

    In order for this to work for you, you would need to do two things:
    1. Change the directories of each file to point to your specific .exe
    2. Change the # after the "call wait" command to the amount of seconds you want the delay to exist.

    After you're done copying & pasting, file > save as > save as type "All Files" > File name : "Start Server.bat" (or whatever you want it to be named. Be sure to put this in the same folder you saved the wait.bat file you saved earlier.)

    Create a shortcut, and put it on your desktop!

    Sorry this post was so long, I wanted to explain what was going on as opposed to simply throwing some codes on here for people to take without fully understanding it.. Hope it's helpful!

    Tip: You can even use this to launch your neuz.exe file, and start up fly after you've started all of the server programs. Just use the same syntax, add another line and point to your neuz.exe file.
    Last edited by JBurrke; 25-02-10 at 10:55 AM.


  2. #2
    Newbie OMrDeadlyO is offline
    MemberRank
    Feb 2010 Join Date
    2Posts

    Re: [Guide] Start Server.bat

    Heey Jburkke i did everything you said but it still give me a error with the Database it says Failed too read Ini can you tell me how to fix this plz :) appricait u did this^^ helpz allot

  3. #3
    Newbie JBurrke is offline
    MemberRank
    Feb 2010 Join Date
    5Posts

    Re: [Guide] Start Server.bat

    Quote Originally Posted by OMrDeadlyO View Post
    Heey Jburkke i did everything you said but it still give me a error with the Database it says Failed too read Ini can you tell me how to fix this plz :) appricait u did this^^ helpz allot
    Do you get this error when you run the server manually? If not, the only suggestion I have is to make the wait command last a little longer, try 2 or 3.. Sometimes 1 second wont be enough to allow the programs to open up and start running in time, so you have to give it more of a pause in between programs

    Hope you get it working

  4. #4
    Newbie OMrDeadlyO is offline
    MemberRank
    Feb 2010 Join Date
    2Posts

    Re: [Guide] Start Server.bat

    Quote Originally Posted by JBurrke View Post
    Do you get this error when you run the server manually? If not, the only suggestion I have is to make the wait command last a little longer, try 2 or 3.. Sometimes 1 second wont be enough to allow the programs to open up and start running in time, so you have to give it more of a pause in between programs

    Hope you get it working
    nope when i do it manualy i dont get the error il try too make them last longer other wise i really dont know Ty again:)

  5. #5
    Grand Master ryuchao009 is offline
    Grand MasterRank
    Feb 2009 Join Date
    United StatesLocation
    601Posts

    Re: [Guide] Start Server.bat

    The database server normally takes a long time to load, so you will probably want to set the core server to wait 10-15 seconds before opening.

    Just a side note, you should be able to set a variable that saves the current directory ( I believe it's %cd%, but I don't remember for sure. Google "cmd.exe environment variables" if you're curious). By using a variable, you can use a relative path instead of an absolute one. Then you could leave the .bat files in the same folder that the Program, Resource, Script folders, and error logs are in.

    Then, you can right-click and make a shortcut of it. Drag that to your desktop and click the shortcut when you need it.

    That was off the top of my head and I'm extremely tired, but it should work.

  6. #6
    Newbie ThuLily is offline
    MemberRank
    Sep 2009 Join Date
    1Posts

    Re: [Guide] Start Server.bat

    @OMrDeadlyO
    check to see if you can open your database.ini by urself. I do not think that JBurke's start server bat set-up will help you that at all.

  7. #7
    Newbie JBurrke is offline
    MemberRank
    Feb 2010 Join Date
    5Posts

    Re: [Guide] Start Server.bat

    Quote Originally Posted by ryuchao009 View Post
    The database server normally takes a long time to load, so you will probably want to set the core server to wait 10-15 seconds before opening.

    Just a side note, you should be able to set a variable that saves the current directory ( I believe it's %cd%, but I don't remember for sure. Google "cmd.exe environment variables" if you're curious). By using a variable, you can use a relative path instead of an absolute one. Then you could leave the .bat files in the same folder that the Program, Resource, Script folders, and error logs are in.

    Then, you can right-click and make a shortcut of it. Drag that to your desktop and click the shortcut when you need it.

    That was off the top of my head and I'm extremely tired, but it should work.
    Well, the problem is that two of the server files are in separate directories, so you have to use absolute paths. Maybe if you placed shortcuts of the world server and whatever the other one is that's in the other directory and called for the bat server to run those files? I'm not sure if that would work though..

    Either way, it doesnt matter what kind of paths you use.. Right click the bat and go to send to > desktop and it creates a shortcut on your desktop :)

    MrDeadly, the only solution I can think of is making the pause last longer.. It all depends on how long it takes your computer to open up the programs, my computer runs fast so they can all open up in one second :P

    Also, does anyone know how to make xp group multiple exes into one icon on the taskbar? Having 7 programs running only leaves me space for like 3 other programs before the entire taskbar is filled up

  8. #8
    Sorcerer Supreme demz123 is offline
    Member +Rank
    Apr 2010 Join Date
    C:/wamp/www/Location
    336Posts

    Re: [Guide] Start Server.bat

    i was using vista is this sumpport with vista?

    ---------- Post added at 06:23 AM ---------- Previous post was at 06:18 AM ----------

    Spoiler:
    @echo off
    start "Account Server" C:\Program Files\GalaNet\FlyffTest\Neurospace\Program\1.AccountServer.exe"
    call wait 1
    start "Database Server" C:\Program Files\GalaNet\FlyffTest\Neurospace\Resource\2.DatabaseServer.exe"
    call wait 1
    start "Core Server" C:\Program Files\GalaNet\FlyffTest\Neurospace\Program\3.CoreServer.exe"
    call wait 1
    start "Certifier" C:\Program Files\GalaNet\FlyffTest\Neurospace\Program\4.Certifier.exe"
    call wait 1
    start "Login Server" C:\Program Files\GalaNet\FlyffTest\Neurospace\Program\5.LoginServer.exe"
    call wait 1
    start "Cache Server" C:\Program Files\GalaNet\FlyffTest\Neurospace\Program\6.CacheServer.exe"
    call wait 1
    start "World Server" C:\Program Files\GalaNet\FlyffTest\Neurospace\Program\WorldServer.exe_fixed.exe"
    exit
    mine like this. i am running windows vista premium xD



Advertisement