Changeset 20637 for gsdl/trunk


Ignore:
Timestamp:
2009-09-18T18:41:06+12:00 (15 years ago)
Author:
ak19
Message:
  1. Many changes to gsicontrol.bat to bring it up to date with the recent changes made to gsicontrol.sh. The httpd.conf.in now has a HOST_IP placeholder instead of HOSTS for the Allow From line. Now the httpd.conf always has at least the home IP (127.0.0.1) as well as the hostIP we write. These ensure that the local URLs localhost and hostname work on Linux and Windows. Other changes: the restart label is implemented differently and other minor corrections. 2. Minor spelling correction to gsicontrol.sh
Location:
gsdl/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/gsicontrol.bat

    r20615 r20637  
    3939echo    configure-apache [config-filename]
    4040echo    configure-cgi
     41echo    set-port
    4142echo    test-gsdlhome
    4243echo    web-stop-tested
     
    102103goto exit
    103104
     105
    104106:restart
     107:: Need to stop server, wait and start it again.
     108:: We're using Ping to implement batch file Wait
    105109if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" %GS2_APACHE_HTTPD_SIGNAL%
    106 :: wait 4s, see http://malektips.com/dos0017.html. The number in the 2nd line is variable (number of seconds to wait)
    107 ping 127.0.0.1 -n 2 -w 1000 > nul
    108 ping 127.0.0.1 -n 4 -w 1000> nul
    109 ::"%GSDLHOME%\bin\windows\starthttpd.exe" %GS2_APACHE_HTTPD_SIGNAL% "%GSDLHOME%\apache-httpd\windows\bin\httpd.exe"
     110
     111:: Wait 5 seconds and then start. See http://ss64.com/nt/sleep.html (and http://malektips.com/dos0017.html)
     112:: if loopback IP address (127.0.0.1) does not exist, we ask them to manually start it up again
     113ping -n 1 -w 1000 127.0.0.1 |find "TTL=">nul || goto failmsg
     114echo Waiting for re-start....
     115ping -n 5 -w 1000 127.0.0.1> nul
    110116goto start
     117
     118:failmsg
     119echo Unable to wait for restart. Manually run %0 web-start
     120goto exit
     121
    111122
    112123::status
     
    184195:: See http://ss64.com/nt/for_cmd.html, http://ss64.com/nt/findstr.html (and http://ss64.com/nt/find.html)
    185196FOR /F "tokens=2 delims==" %%G IN ('findstr /R ^portnumber %configfile%') do set port=%%G
    186 echo Found port %port%
    187 FOR /F "tokens=2 delims==" %%G IN ('findstr /R ^externalaccess %configfile%') do set connect=%%G
    188 
    189 if "%connect%" == "1" set allowfrom="all"& goto portcon
    190 FOR /F "tokens=2 delims==" %%G IN ('findstr /R ^host %configfile%') do set allowfrom=%%G
     197FOR /F "tokens=2 delims==" %%G IN ('findstr /R ^hostIP %configfile%') do set hostIP=%%G
     198FOR /F "tokens=2 delims==" %%G IN ('findstr /R ^externalaccess %configfile%') do set allowfromall=%%G
     199
     200if "%allowfromall%" == "1" set allowfromall="Allow"& goto portcon
     201set allowfromall="Deny"
    191202
    192203:: Using CALL to jump to labels means we can return from them. BUT need to ensure
     
    195206goto portcon
    196207
     208
    197209::configure-port-and-connection
    198210:setport
    199211set /p port=Enter port number to use:
    200 set /p connect=Allow external connections [yes/no]:
    201 if "%connect%" == "yes" set allowfrom="all"& goto portcon
    202 if "%connect%" == "y" set allowfrom="all"& goto portcon
    203 
    204 set /p allowfrom=Enter host (hostname, IP, localhost, 127.0.0.1) to use:
     212set /p hostIP=Enter host IP to allow (127.0.0.1 is included by default):
     213set /p allowfromall=Allow external connections [yes/no]:
     214
     215if "%allowfromall%" == "yes" set allowfromall="Allow"& goto portcon
     216if "%allowfromall%" == "y" set allowfromall="Allow"& goto portcon
     217set allowfromall="Deny"
    205218goto portcon
    206219
     
    218231if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" %GS2_APACHE_HTTPD_SIGNAL% SILENT
    219232echo Setting config file to use port %port%
    220 type "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf.in" | %_sed% "s@\*\*PORT\*\*@%port%@g" | %_sed% "s@\*\*CONNECTION\*\*@%allowfrom%@g" | %_sed% "s@\*\*GSDLHOME\*\*@%safepath%@g" | %_sed% "s@\*\*APACHE_HOME_OS\*\*@%safepath%\/apache-httpd\/%GSDLOS%@g" > "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf"
     233type "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf.in" | %_sed% "s@\*\*PORT\*\*@%port%@g" | %_sed% "s@\*\*CONNECTPERMISSION\*\*@%allowfromall%@g" | %_sed% "s@\*\*HOST_IP\*\*@%hostIP%@g" | %_sed% "s@\*\*GSDLHOME\*\*@%safepath%@g" | %_sed% "s@\*\*APACHE_HOME_OS\*\*@%safepath%\/apache-httpd\/%GSDLOS%@g" > "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf"
    221234echo Type '%0 web-start' to start the web server running on port %port%
    222235echo Done
    223236
    224 set connect=
    225 set allowfrom=
     237set allowfromall=
    226238set _sed=
    227239set safepath=
     240set port=
    228241
    229242:: Extra processing for configure-web and configure-cgi command targets
    230 if not "%target%" == "cfgweb" goto exit
    231 if not "%target%" == "cfgcgi" goto exit
     243if not "%target%" == "configure-web" if not "%target%" == "configure-cgi" goto exit
    232244if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" (echo %MONITOR_SUCCESS%) else (echo %MONITOR_FAILED%)
    233245echo %MONITOR_FINISHED%
    234 set port=
    235 set externalaccess=
    236246goto exit
    237247
  • gsdl/trunk/gsicontrol.sh

    r20622 r20637  
    162162# This version runs without testing for GSDLHOME
    163163# Useful to be run as a target when we know test-gsdlhome has already
    164 # been done.  This avoids a unnecessary repetition of printing
     164# been done.  This avoids an unnecessary repetition of printing
    165165# out the values of GSDLHOME and GSDLOS
    166166    if test -e "$GSDLHOME/apache-httpd/$GSDLOS/conf/httpd.conf" ; then
Note: See TracChangeset for help on using the changeset viewer.