Jump to content
The Uniform Server Community
haymann

Modify start.bat

Recommended Posts

This is probably an easy solution, but I have never learned anything about .bat files...

Is it possible to add the mysqlrun.bat info in the start.bat file so that MySQL starts as well when I run start.bat? Right now I have both shortcuts in my start folder, but sometimes I think that mysqlrun.bat starts before start.bat is done.

I thought that having them both start fom the same .bat might be a little more elegant... ;)

Ryan

Share this post


Link to post
Share on other sites
No problem :lol:

1916[/snapback]

 

First I want to thank you for the most excellent work! THANKS!

 

Next,... I looked at the link for the autostart mysql you provided at sourceforge but the solution provided there (afaict) seems to be another batch file.

 

My question comes out of the actual uniserver 3.2a start.bat where there are three lines rem-ed out at the top pertaining to mysql.

@echo off

 

rem use: start mysql console - to start mysql at server start and display console

rem use: start mysql - to start mysql at server start

rem use: start nomysql console - to display console

 

This looks to me like i can insert or un-rem one of those lines in the start.bat to achieve the desired result...? But, like haymann, I too am unskilled and a little confused by the batch file language.

 

Could you please direct me to the correct alteration of the batch file so that I have one file run at start up making certain mysql kicks in after uniserver is started or at an appropriate point to avoid conflicts or failures?

 

I would also like to start unitray in the same batch file if that's possible...

 

On my end I'll try to brush up on batch file writing in the hope that I will chase away a little bit more ignorance in my life...

 

Thanks,

 

curly

 

ps. i hope this is not too much but i figgered i'd post the whole batch file here....

 

@echo off

 

rem use: start mysql console - to start mysql at server start and display console

rem use: start mysql - to start mysql at server start

rem use: start nomysql console - to display console

 

diskw\home\admin\program\pskill.exe Apache.exe

IF NOT ERRORLEVEL 1 goto started

set Disk=%1

IF "%Disk%"=="" set Disk=w

rem create the disk

subst %Disk%: "diskw"

IF ERRORLEVEL 1 goto hint

set apachepath=\usr\local\apache2\

set apacheit=%Disk%:%apachepath%bin\Apache.exe -f %apachepath%conf\httpd.conf -d %apachepath%.

set programit=%Disk%:\home\admin\program\

set closeit=%programit%close.bat %Disk%

 

%Disk%:

cd \usr\local\php

IF "%2"=="mysql" start \usr\local\mysql\bin\mysqld-opt.exe --defaults-file=/usr/local/mysql/bin/my-small.cnf

CLS

echo The server is working on the disk %Disk%:\ [http/127.0.0.1/a/]

start %Disk%:\home\admin\WWW\redirect.html

IF "%3"=="console" goto console

start %programit%uniserv.exe "%apacheit%" "%closeit%"

goto end

:console

%apacheit%

%closeit%

goto end

:hint

CLS

echo The disk %Disk% is busy. Use start.bat [disk letter]

goto pause

:started

CLS

echo ERROR!!!

echo One of the instances of Apache server is started. Use stop.bat

:pause

echo .

pause

:end

Share this post


Link to post
Share on other sites

Thanks for the quick reply! But, no, didn't work. It looks like the section beginning

 

%Disk%:

cd \usr\local\php

IF "%2"=="mysql" start \usr\local\mysql\bin\mysqld-opt.exe --defaults-file=/usr/local/mysql/bin/my-small.cnf

CLS

 

might need some dressing up or maybe I need to "set mysql=%2" in the batch?

 

no, that didn't work either...

 

I like the ultra portability of uniserver so this is why i'd like to have one batch file and hopefully avoid installing the services.

 

I'll keep messing with the batch file and command referrence at microsoftand post the working results if any.

Share this post


Link to post
Share on other sites

There is a way to do it, but it has slipped my mind, kinda sick. 3.3 comes with a VBSript that allows you to start MySQL with the server. I will try and remember or go back to the code, but for now, i need rest :lol: lol.

Share this post


Link to post
Share on other sites

Hi,

 

Try to just remove the If statement in the beginning of the row.

 

I have done a this to my start.bat file.

 

 

%Disk%:
cd \usr\local\php
start \usr\local\mysql\bin\mysqld-opt.exe --defaults-file=/usr/local/mysql/bin/my-small.cnf
CLS

 

 

/BK

Share this post


Link to post
Share on other sites

Egggsellllent, /bk. works like a charm. Thanks!

 

We'll get that wiki filled in soon if we keep it up.

 

And now I will send my imaginary, super hot and sweet nurse to Olaj and she will feed him soup and give him a sponge bath...

 

Many thanks all.

 

curly

Share this post


Link to post
Share on other sites

Just run a Command Prompt in the Uniform Server Directory and type:

start.bat mysql

(Don't use start as it may call Windows's start.exe instead of Uniform Server's start.bat)

 

You could also make a shortcut with \start.bat mysql as the target and make it start in the Uniform Server Directory.

Btw, don't forget to change to the Directory where you have Uniform Server installed :D

 

No need for all the "messy" (imho) editing :lol:

Edited by MrX

Share this post


Link to post
Share on other sites

No need for all the "messy" (imho) editing :lol:

1967[/snapback]

 

How did you know my batch file is getting all messy?... heh

 

Anyway, my goal is automation without having to open a whole command prompt, etc. yadda... It seems to me it would actually be easier to just start mysql from the spawned admin page which works fine.

 

So far BK's suggestion worked gloriously (afict) and I've also used the same syntax adding Q&E FTP to the same batch file. I put a shortcut to my edited start.bat in the startup folder but I haven't actually tried it with a restart yet.

 

SooOOOo, with my growing knowledge of batch files and your suggestion I may just make an entirely new batch file for my start up folder which calls the appropriate bat files after a delay which will allow XP to get settled first.

 

I realize I may be reinventing the wheel here but what the hey...

 

Looking forward to the new release with the vb script.... (btw I would be happy to give it a pre-release whirl)

 

Thanks,

 

curly

Share this post


Link to post
Share on other sites

Actually the correct code (for a default install) is ...

 

start.bat w mysql

 

Note the first parameter is the virtual drive letter (default is w)

I run it as a modified shortcut on the desktop

 

The comments on lines 9-11 of start.bat are incorrect according

to the batch commands below it! Also a bit of confusion over what these line mean.

Could I suggest:

 

rem  Server start options for this batch file:
rem     start w mysql console    - to start mysql at server start and display console
rem     start w mysql    - to start mysql at server start
rem     start w nomysql console    - to display console

 

%1 = Drive letter created by the server

%2 = MYSQL if you want to run MYSQL automatically

%3 = CONSOLE if you want to leave console open

 

Just my 19cents ...

 

Cheers

Kyle

Share this post


Link to post
Share on other sites

I may be kicking a dead horse by posting yet another opinion, but I want to say that you can avoid the need to open a command prompt and also avoid having to edit the batch file by simply setting the target of a Windows shortcut to:

 

"C:\Uniform Server\Server_Start.bat" w mysql

 

Of course you must modify this to conform to the actual location of the Uniform Server on your own machine.

 

Sometimes I like to have the Uniform Server go directly to the website I am developing rather than having it display the apanel. This is especially nice when showing off your work to a customer or to colleages. I accomplish this by changing the file:

 

"C:\Uniform Server\diskw\home\admin\www\redirect.html"

 

There is a javascript script element in this file containing a window.setInterval() call that you can change to reference your home page. For example:

 

window.setInterval("window.location = 'http://localhost/mycoolsite/'", 500);

 

Of course you should safely preserve the original so you can revert to displaying the apanel since that is the best approach for general development use.

 

Finally. an experiment that I have not tried yet is to make the redirect.html modification above and then put the whole thing onto a CD-ROM with an autorun that will launch the server with the correct SQL enabled command line.

Share this post


Link to post
Share on other sites

:) Sorry, but no can do, it's not quite that easy... first thing that'll happen: Apache trying to write to its own (now readonly) log files that it has started... second thing is the same for the MySQL server.

 

The solution would be something like:

Reconf Apache to store temp and log files on c:

Reconf MySQL to store all data on c:

Each time the CD is autorun, it should run a check to see if it has been run before (like, if c:\UniServFiles\ doesn't exist, create it and copy the MySQL datafiles over there for use).

Optimum, the system should check if port 80 is in use already? OK, not needed, but practical...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...