Old:Bugs 3.5-Apollo: Server Start bat: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 12: | Line 12: | ||
Proposal let this open a command prompt accessing the MySQL bin folder will allow command line control of the MySQL server using mysql.exe and mysqladmin.exe. I have taken the opportunity to add comments, cleaned-up the script and changed order of commands slightly. | Proposal let this open a command prompt accessing the MySQL bin folder will allow command line control of the MySQL server using mysql.exe and mysqladmin.exe. I have taken the opportunity to add comments, cleaned-up the script and changed order of commands slightly. | ||
'''''Enhancement'':''' Enclose batch commands between '''pushd %~dp0''' and '''popd''' forces current working directory to the folder a batch file is located in. On completion restores original calling working directory. Allows remote processes to start servers. | |||
'''''Proposed changes:''''' | '''''Proposed changes:''''' | ||
Line 22: | Line 24: | ||
rem To Developers: Implemented %www%, and %apanel% :) | rem To Developers: Implemented %www%, and %apanel% :) | ||
rem Proposed mods MPG 14-4-2008 | rem Proposed mods MPG 14-4-2008 | ||
rem Proposed enhancement MPG 3-7-08 | |||
@echo off | @echo off | ||
rem working directory current folder | |||
pushd %~dp0 | |||
rem Command line parameters: | rem Command line parameters: | ||
rem Server_Start.bat %1 %2 %3 | rem Server_Start.bat %1 %2 %3 | ||
rem %1 = Drive letter to use | rem %1 = Drive letter to use | ||
rem %2 = mysql (run MySql server) or nomysql (do not run MySql server) | rem %2 = mysql (run MySql server) or nomysql (do not run MySql server) | ||
rem %3 = console (Open a command prompt at folder MySQL Bin) | rem %3 = console (Open a command prompt at folder MySQL Bin) | ||
rem Note: If using %2 you must set a value for %1 | rem Note: If using %2 you must set a value for %1 | ||
rem Note: If using %3 you must set values for %1 and %2 | rem Note: If using %3 you must set values for %1 and %2 | ||
rem Note: Default, uses drive W, runs the MySQL server and does not a command prompt. | rem Note: Default, uses drive W, runs the MySQL server and does not a command prompt. | ||
rem ### Is Apache running if it is jump to STARTED | rem ### Is Apache running if it is jump to STARTED | ||
rem ### First check for system error jump to Pause allows error message to be displayed. | |||
udrive\home\admin\program\pskill.exe Apache.exe | udrive\home\admin\program\pskill.exe Apache.exe | ||
if errorlevel 2 goto :PAUSE | if errorlevel 2 goto :PAUSE | ||
Line 47: | Line 53: | ||
if errorlevel 1 goto :HINT | if errorlevel 1 goto :HINT | ||
rem ### Drive was created. Create variables for paths and programs | rem ### Drive was created. Create variables for paths and programs | ||
set apachepath=\usr\local\apache2\ | set apachepath=\usr\local\apache2\ | ||
set apacheit=%Disk%:%apachepath%bin\Apache.exe -f %apachepath%conf\httpd.conf -d %apachepath%. | set apacheit=%Disk%:%apachepath%bin\Apache.exe -f %apachepath%conf\httpd.conf -d %apachepath%. | ||
Line 72: | Line 78: | ||
:NOMYSQL | :NOMYSQL | ||
rem ### Does user want to run a command prompt, if not END | rem ### Does user want to run a command prompt, if not END | ||
if "%3"=="console" goto :CONSOLE | if "%3"=="console" goto :CONSOLE | ||
goto :END | goto :END | ||
Line 78: | Line 84: | ||
:CONSOLE | :CONSOLE | ||
rem ### User wants to run a command prompt. Opens in MySQL bin | rem ### User wants to run a command prompt. Opens in MySQL bin | ||
rem ### Allows command clients to be used (musql.exe and mysqladmin.exe ) | rem ### Allows command clients to be used (musql.exe and mysqladmin.exe ) | ||
%Disk%: | %Disk%: | ||
cd \usr\local\mysql\bin | cd \usr\local\mysql\bin | ||
Line 91: | Line 97: | ||
:STARTED | :STARTED | ||
CLS | CLS | ||
echo ERROR!!! | echo ERROR!!! | ||
echo One of the instances of Apache server is started. Use stop.bat | echo One of the instances of Apache server is started. Use stop.bat | ||
Line 99: | Line 105: | ||
:END | :END | ||
rem restore original working directory | |||
popd | |||
</pre> | </pre> | ||
Line 122: | Line 132: | ||
| [[Image:uc_small_logo.gif]] || [[User:Ric|Ric]] | | [[Image:uc_small_logo.gif]] || [[User:Ric|Ric]] | ||
|} | |} | ||
[[Category: UniCenter]] | [[Category: UniCenter]] |
Revision as of 20:45, 3 July 2008
Uniform Server 3.5-Apollo known bugs or issues. |
Server_Start.bat
Bug fix reinstate %2
File: Server_Start.bat
Location: *\Uniform Server
Problem: Parameter %2 not checked preventing disk_start.vbs running correctly. Redundant %3 parameter! Solution: Reinstate %2 checking and use %3 to open a command line prompt.
The third parameter %3 (Console) seems to be redundant no idea what it’s original purpose was. When run it just leaves the command prompt open, which is of little use.
Proposal let this open a command prompt accessing the MySQL bin folder will allow command line control of the MySQL server using mysql.exe and mysqladmin.exe. I have taken the opportunity to add comments, cleaned-up the script and changed order of commands slightly.
Enhancement: Enclose batch commands between pushd %~dp0 and popd forces current working directory to the folder a batch file is located in. On completion restores original calling working directory. Allows remote processes to start servers.
Proposed changes:
rem Name: Server_Start.bat rem Location: Uniform Server rem Created By: The Uniform Server Development Team rem Edited Last By: Olajide Olaolorun (empirex) rem Comment: After start, go to apanel directly. rem To Developers: Implemented %www%, and %apanel% :) rem Proposed mods MPG 14-4-2008 rem Proposed enhancement MPG 3-7-08 @echo off rem working directory current folder pushd %~dp0 rem Command line parameters: rem Server_Start.bat %1 %2 %3 rem %1 = Drive letter to use rem %2 = mysql (run MySql server) or nomysql (do not run MySql server) rem %3 = console (Open a command prompt at folder MySQL Bin) rem Note: If using %2 you must set a value for %1 rem Note: If using %3 you must set values for %1 and %2 rem Note: Default, uses drive W, runs the MySQL server and does not a command prompt. rem ### Is Apache running if it is jump to STARTED rem ### First check for system error jump to Pause allows error message to be displayed. udrive\home\admin\program\pskill.exe Apache.exe if errorlevel 2 goto :PAUSE if not errorlevel 1 goto :STARTED rem ### Apache not running. Check for drive letter if not set (%1) use default. set Disk=%1 if "%Disk%"=="" set Disk=w rem ### Create the virtual disk, if it fails go to Hint subst %Disk%: "udrive" if errorlevel 1 goto :HINT rem ### Drive was created. Create variables for paths and programs 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% rem ### Change path to PHP - Required for running scripts %Disk%: cd \usr\local\php rem ### Provide feedback to user CLS echo The server is working on the disk %Disk%:\ [http/127.0.0.1/apanel/] rem ### Start Apache server start %programit%uniserv.exe "%apacheit%" "%closeit%" rem ### Start Apanel start \home\admin\www\redirect.html rem ### Start MySQL server - skip if requested not to start (%2) if "%2"=="nomysql" goto :NOMYSQL start \usr\local\mysql\bin\mysqld-opt.exe --defaults-file=/usr/local/mysql/bin/my-small.cnf :NOMYSQL rem ### Does user want to run a command prompt, if not END if "%3"=="console" goto :CONSOLE goto :END :CONSOLE rem ### User wants to run a command prompt. Opens in MySQL bin rem ### Allows command clients to be used (musql.exe and mysqladmin.exe ) %Disk%: cd \usr\local\mysql\bin start cmd.exe 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 rem restore original working directory popd
Download
Download this file Server_Start.bat.txt save as Server_Start.bat and copy to the folder Uniform Server.
Allow it to overwrite the existing file.
Forum reference
Additional information or background can be found on these forum pages.
None
Proposed solution
See above.
Ric |