How I start my servers

Applications/Tools written to make running DarkStar easier for the rest of us.
Post Reply
Delaide
Posts: 478
Joined: Sat Jun 14, 2014 8:58 am

How I start my servers

Post by Delaide » Tue Jan 13, 2015 7:22 am

So, trying to give back what little I can, I wanted to share with everyone how I start my servers.

Right now I am working on a Visual C program that will allow me to not only start my servers, but to modify my settings without having to open the config. Sadly, I have just started that program, and will probably not complete it for a while.

So, I will share the simple bat file I use.

Here is my bat code:

Code: Select all

@echo off

:: BatchGotAdmin from https://sites.google.com/site/eneerge/scripts/batchgotadmin
:-------------------------------------
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
:--------------------------------------

rem Login Server
cd "I:\PlayOnline\SquareEnix\Final Fantasy XI server\darkstar\"
start DSConnect-server.exe
rem Game Server
start DSGame-server.exe
rem Search Server
start DSSearch-server.exe
rem Ashita
cd "I:\PlayOnline\SquareEnix\Ashita 2\"
start Ashita.exe
exit
Now, if you want to use this, a few warnings. First, you will need to change the file paths to your files. The cd is simply to change to the folder, and the start command starts the exe file.
Also, I have found that the cd does not change to another drive, so if you have your stuff in another drive, you must do it different, for example:

Code: Select all

rem Login Server
D:
cd "D:\PlayOnline\SquareEnix\Final Fantasy XI server\darkstar\"
start DSConnect-server.exe
That would be done if it is in the D drive. Then you can change the folders to match.

Now, one other issue I am working on, but have not yet figured it out. So, I fixed the issue with the User Access Control popping up every time, but it will still pop up when you first click to run the batch file. At least you only have to click it once now. What this does is allow me to put a shortcut on my desktop, and just click this to launch. Eventually, I hope to make it more automated.
Last edited by Delaide on Thu Jan 15, 2015 8:39 am, edited 1 time in total.

Delaide
Posts: 478
Joined: Sat Jun 14, 2014 8:58 am

Re: How I start my servers

Post by Delaide » Tue Jan 13, 2015 7:28 am

A question for anyone who can answer. I am trying to create a program that will allow me to autostart the server with a simple button click.
Currently I use a batch file to do that, but the User Control issue is a pain. I have to click the shield before it will start the next. I will post that later.

Anyways, the program I am testing that will start the login server gives me this:
Unstarting status.png
The login server won't start.

But, I know it isn't a problem with the server itself. I can start it just fine by running my batch file (Although it does prompt me to accept the User Security shield thing), but I cannot get it to start using this program I created.

The entire code for the Visual Basic program is:

Code: Select all

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Process.Start("D:\PlayOnline\SquareEnix\Final Fantasy XI server\darkstar\DSConnect-server.exe")
    End Sub
End Class
So, there isn't any coding issues. I think it is a Windows Security authorization issue. Any idea how to fix this?

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: How I start my servers

Post by whasf » Tue Jan 13, 2015 12:35 pm

You need to copy over all the folders except "src" to your path you put the DSP files otherwise spells, NPC's and such won't work. Why are you copying the DSP exe's to your POL/FFXI folder? That's just an extra step you have to do each time you rebuild the servers. They don't need any client files. Just start them from where Visual Studio puts them.
-- Whasf

User avatar
atom0s
Developer
Posts: 537
Joined: Thu Oct 25, 2012 9:52 am

Re: How I start my servers

Post by atom0s » Tue Jan 13, 2015 2:19 pm

For the batch scripts, you can do a restarter like this:

Code: Select all

@echo off
cls
@echo [Lobby Server AutoRestart Script]
@echo Starting server for first time: %date% %time%
:restart
start /wait DSConnect-Server.exe
@echo [CRASH] %date% %time% - Restarting the lobby server..
goto restart
This way anytime the server crashes, the batch script will automatically restart it.

To bypass UAC, right-click your batch file and launch it as an Administrator. That way it should have full permission to do whatever without UAC being annoying.

As for your Process.Start question, you need to set the base working directory for the Process invokation. Otherwise it is going to use the path you have the application located at. You can use the overload method that takes a ProcessStartInfo object to start the process and populate it with the needed data to launch at the given directory. Like this:

Code: Select all

var startInfo = new ProcessStartInfo()
    {
        FileName = @"D:\PlayOnline\SquareEnix\Final Fantasy XI server\darkstar\DSConnect-server.exe",
        WorkingDirectory = @""D:\PlayOnline\SquareEnix\Final Fantasy XI server\darkstar\"
    };
Process.Start(startInfo);

Delaide
Posts: 478
Joined: Sat Jun 14, 2014 8:58 am

Re: How I start my servers

Post by Delaide » Tue Jan 13, 2015 9:24 pm

@whasf
To be honest, I just keep everything in the PlayOnline folder. Then I know where to find everything. In my PlayOnline folder, I have multiple things, including my character backups and my dat backups, since I put some modified dats in.
Here is the one that I run my tests on (My home folder has more things like my dats backup, since I don't change dats on this particular computer):
folder configuration.JPG
My eventual goal is to have a single window for all the server needs.
Here is what I have right now:
DSP Control.JPG
I got the idea from the launcher from this:
http://www.ac-web.org/forums/showthread ... er+project

Basically, you click the program, and it launches a form. This form has the ability to change your server config files, to export character data, to import character data, to launch the server, and to stop the server. This is what I want.

When the server launches, it will run in silent mode, so will remove the separate command boxes. You can still review the messages through the server launcher though, so there is no loss of data, just a single control box application shown. You can also shut down and restart the server. So for example, I can config the server through this single program, and it will save those changes to the appropriate config file. I can then restart the servers or start them if they weren't going in the first place. I could also shut the servers down but still leave the control application up.

It brings in everything into one handy box.

Once I have that, I plan to add in further functionality, like being able to build your servers automatically (I am trying to study how to compile from the command line so I can automate it), being able to import or export character data, even being able to update from git and update the server after any update, like an update available, thing. But I think being able to automatically pull git and stuff will wait until I have the basics done. It is just a program that, while not needed, will serve two functions.
1. Make it easier to manage a DSP server (and even automate most of it)
2. Teach me how to write programs so hopefully I can contribute back to the project

Honestly, I have started studying programming again only because of the DSP project, because I want to find a way to contribute back. While all of this is not needed, it seems like it might help to simplify the overall experience for those who aren't very good at computers, and to get rid of the window clutter, because personally it annoys me a little to have the three windows open (lobby, game server, search server). Not that it is that annoying, just one of those little things I think would be better if it was cleaned up.

xelloss
Posts: 57
Joined: Sat Mar 09, 2013 1:09 am

Re: How I start my servers

Post by xelloss » Wed Jan 14, 2015 10:33 am

You don't need to use batch files or write a program just to start / manage the servers on Windows, though the latter will allow you to make it 'pretty'. With a properly configured ConEmu, it's a one click start and everything will be neatly managed. Changing settings while active is more interesting and to my knowledge would require something of your own design, but if you're looking for something that just starts / manages ConEmu is what you should be using.

Delaide
Posts: 478
Joined: Sat Jun 14, 2014 8:58 am

Re: How I start my servers

Post by Delaide » Thu Jan 15, 2015 9:40 am

Actually Xelloss, I am doing it for more than one reason. One to learn how to do this stuff, and two, because I want to make an integrated single launcher for the server/game, so I will no longer need to click to folders, click multiple things, and click through multiple configs. It will start simple and build as I learn more.

btw, my batch file is fixed. It will now only pop up the User Access Service once, then not again while it launches everything.

Post Reply