Old:Bugs 3.5-Apollo: Apanel not displayed

From The Uniform Server Wiki
Revision as of 12:30, 21 June 2013 by BobS (talk | contribs) (BobS moved page Bugs 3.5-Apollo: Apanel not displayed to Old:Bugs 3.5-Apollo: Apanel not displayed without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Uniform Server 3.5-Apollo known bugs or issues.

Server_Start.bat

Bug fix: Apanel initial display

File: Server_Start.bat
Location: *\Uniform Server

Problem: In certain situations Apanel is requested before Apache is running resulting in browser error message "Failed to connect"

Solution: Before requesting the Apanel page, wait for Apache to start using a delay loop.


In the past I have proposed using ping to introduce a delay, however this fails if the IP address used is in use.

An elegant solution is now possible using the delay taken from the mini-servers series. It's a small C-program, fully documented and including source code hence officially open source.

Implementation

Copy file unidelay.exe to folder udrive\home\admin\program

Edit Server_Start.bat and add the following block of code just above line start %apanel%\redirect.html

rem ### Before starting Apanel wait for Apache to start 
rem ### Safety loop counter cnt give up after 60 seconds
echo starting Apache ...............
set /a cnt=0
:next
set /a cnt+=1
if "%cnt%"=="60" goto :TIMEDOUT
\home\admin\program\unidelay.exe
\home\admin\program\pskill.exe apache.exe > nul
IF ERRORLEVEL 1 goto :next

Add the following block of code just above line :HINT

:TIMEDOUT
rem ### Apache failed to start. Kill virtual drive. Inform user
subst %Disk%: /D
CLS
echo Unable to start Apache Server
goto :PAUSE

Script first resets the safety loop counter; this is incremented each time around the loop. On reaching a count of 60 (approx 60 seconds) it is assumed Apache is never going to start. Script transfers control to the TIMEDOUT section killing virtual drive created and informs user. The Apache process is checked every second (unidelay.exe with no parameters defaults to 1 second) if errorlevel returned is 1, loop is repeated (:next). A zero value confirms Apache is running; script exits loop and runs next line of code (Starts Apanel).

Download

Download program unidelay.exe note this is included in the combined bug fix download.

MD5 = f9183635b0b23b212ab20e679d5c348e

Reference

Additional information or background can be found on the following pages:

LCC-win32: compile unidelay

Mini Servers: Start Stop design notes

Proposed solution

See above.


Uc small logo.gif Ric