Changeset 20262


Ignore:
Timestamp:
2009-08-14T20:14:24+12:00 (15 years ago)
Author:
ak19
Message:

The minor changes to make this script behave like the bash equivalent, before testing and committing the changes for configure-apache.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/gsicontrol.bat

    r20184 r20262  
    22
    33setlocal
    4 set testdone=0
     4::set testdone=0
    55set target=%1
    66set configfile=%2
     7
     8:: Construct the signal using the unique GS2 installation
     9:: directory (after replacing colons and backslashes)
     10for /F "delims=*" %%T in ('"echo %GSDLHOME%| bin\windows\sed.exe s@[\\:]@_@g"') do set signal=%%T
     11set GS2_APACHE_HTTPD_SIGNAL=GS2_APACHE_HTTPD_%signal%
     12rem echo Signal is: %GS2_APACHE_HTTPD_SIGNAL%
    713
    814:: Need to get greenstone installation directory
     
    1521:: check that we have >=1 and <=2 arguments
    1622:chkargs
    17 if "%target%" == "" goto :usage
    18 if not "%3" == "" goto :usage
     23if "%target%" == "" goto usage
     24if not "%3" == "" goto usage
    1925    goto begincmd
    2026
     
    2733echo    web-stop
    2834echo    web-restart
     35::echo    web-status
     36::echo    web-graceful
    2937echo    configure-admin
    3038echo    configure-web    [config-filename]
    3139echo    configure-apache [config-filename]
    3240echo    configure-cgi
    33 
    34 ::echo    web-status
    35 ::echo    web-graceful
    36 ::echo    test-gsdlhome
    37 ::echo    web-stop-tested
     41echo    test-gsdlhome
     42echo    web-stop-tested
    3843echo.
    3944goto exit
     
    5762::MAIN MENU
    5863:commands
     64echo.
     65echo Using:
     66echo   GSDLHOME = %GSDLHOME%
     67echo   GSDLOS = %GSDLOS%
     68echo.
     69
    5970if "%target%" == "web-start" goto start
    6071if "%target%" == "web-stop" goto stop
    6172if "%target%" == "web-restart" goto restart
    62 if "%target%" == "web-status" goto status
    63 if "%target%" == "web-graceful" goto graceful
     73rem if "%target%" == "web-status" goto status
     74rem if "%target%" == "web-graceful" goto graceful
    6475if "%target%" == "configure-admin" goto cfgadmin
    6576if "%target%" == "configure-web" goto cfgweb
    6677if "%target%" == "configure-apache" goto cfgapach
    6778if "%target%" == "configure-cgi" goto cfgcgi
    68 if "%target%" == "test-gsdlhome" goto testgsdl
     79:: already tested gsdlhome (and web-stop-tested) above, don't want to keep looping on it
     80if "%target%" == "test-gsdlhome" goto exit
     81rem if "%target%" == "web-stop-tested" goto exit
    6982if "%target%" == "portcon" goto portcon1
    7083    :: unknown command
     84    echo Command unrecognised: %target%
    7185    goto usage
    7286
     
    7488:: START starts the app in a new console named by the string following immediately thereafter
    7589:: then we start up apache-httpd and pass the signal that the stop command will respond to
    76 START "%GSDLHOME%\apachectl" "%GSDLHOME%\bin\windows\starthttpd.exe" GS2_APACHE_HTTPD "%GSDLHOME%\apache-httpd\windows\bin\httpd.exe"
     90START "%GSDLHOME%\apachectl" "%GSDLHOME%\bin\windows\starthttpd.exe" %GS2_APACHE_HTTPD_SIGNAL% "%GSDLHOME%\apache-httpd\windows\bin\httpd.exe"
    7791echo %MONITOR_SUCCESS%
    7892echo %MONITOR_FINISHED%
     
    8094
    8195:stop
    82 if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" GS2_APACHE_HTTPD
    83 rem if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\apache-httpd\%GSDLOS%\bin\apachectl" stop
     96:stoptest
     97if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" %GS2_APACHE_HTTPD_SIGNAL%
     98if "%target%" == "web-stop-tested" goto exit
    8499echo %MONITOR_SUCCESS%
    85 echo %MONITOR_FINISHED% 
     100echo %MONITOR_FINISHED%
    86101goto exit
    87102
    88103:restart
    89 if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" GS2_APACHE_HTTPD
    90 :: wait 2s, see http://malektips.com/dos0017.html. The 2 in the 2nd line is variable
     104if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" %GS2_APACHE_HTTPD_SIGNAL%
     105:: wait 4s, see http://malektips.com/dos0017.html. The number in the 2nd line is variable (number of seconds to wait)
    91106ping 127.0.0.1 -n 2 -w 1000 > nul
    92 ping 127.0.0.1 -n 2 -w 1000> nul
    93 ::"%GSDLHOME%\bin\windows\starthttpd.exe" GS2_APACHE_HTTPD "%GSDLHOME%\apache-httpd\windows\bin\httpd.exe"
     107ping 127.0.0.1 -n 4 -w 1000> nul
     108::"%GSDLHOME%\bin\windows\starthttpd.exe" %GS2_APACHE_HTTPD_SIGNAL% "%GSDLHOME%\apache-httpd\windows\bin\httpd.exe"
    94109goto start
    95110
     
    97112:graceful
    98113::echo Command %target% is not yet operational (no local apache web server included in this release).
    99 goto exit
    100 
    101 :stoptest
    102 if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" GS2_APACHE_HTTPD
    103 rem if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\apache-httpd\%GSDLOS%\bin\apachectl" stop
    104114goto exit
    105115
     
    110120if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" goto cgimsg
    111121    echo Configuring cgi-bin\gsdlsite.cfg
    112     set gsdlpath=%GSDLHOME%
    113     for /F "delims=*" %%T in ('"echo %gsdlpath%| bin\windows\sed.exe s@\\@\\\\@g"') do set safepath=%%T
    114     bin\windows\sed.exe "s@\*\*GSDLHOME\*\*@\"%safepath%\"@g" cgi-bin/gsdlsite.cfg.in > cgi-bin/gsdlsite.cfg
    115     set gsdlpath=
     122    for /F "delims=*" %%T in ('"echo %GSDLHOME%| bin\windows\sed.exe s@\\@\\\\@g"') do set safepath=%%T
     123    bin\windows\sed.exe "s@\*\*GSDLHOME\*\*@\"%safepath%\"@g" cgi-bin/gsdlsite.cfg.in > cgi-bin/gsdlsite.cfg   
    116124    set safepath=
    117125    goto cgifin
     
    130138::configure-apache
    131139:cfgapach
    132 if exist "%GSDLHOME%\llssite.cfg" goto :exit
    133 if not exist "%GSDLHOME%\llssite.cfg.in" goto :exit
     140if exist "%GSDLHOME%\llssite.cfg" goto exit
     141if not exist "%GSDLHOME%\llssite.cfg.in" goto exit
    134142    copy llssite.cfg.in llssite.cfg
    135143    set configfile="%GSDLHOME%\llssite.cfg"
     
    159167    echo Did not set password
    160168)
     169echo.
    161170goto exit
    162171
     
    170179
    171180:portcon2
    172 if "%port%" == "" goto exit
     181if "%port%" == "" echo Done& goto exit
    173182    set _sed="bin\windows\sed.exe"
    174     set gsdlpath=%GSDLHOME%
    175     for /F "delims=*" %%T in ('"echo %gsdlpath%| bin\windows\sed.exe s@\\@\/@g"') do set safepath=%%T
     183    for /F "delims=*" %%T in ('"echo %GSDLHOME%| bin\windows\sed.exe s@\\@\/@g"') do set safepath=%%T
    176184
    177185    echo Port: %port%
    178186    echo Stopping web server (if running)
    179     if not exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" echo missing conf file
    180     if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" GS2_APACHE_HTTPD SILENT
     187    if not exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" echo Missing conf file
     188    if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" %GS2_APACHE_HTTPD_SIGNAL% SILENT
    181189    echo Setting config file to use port %port%
    182 bin\windows\sed.exe "s@\*\*GSDLHOME\*\*@\"%safepath%\"@g" cgi-bin/gsdlsite.cfg.in > cgi-bin/gsdlsite.cfg
    183190    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"
    184191    echo Type '%0 web-start' to start the web server running on port %port%
     
    189196    set _sed=
    190197    set safepath=
    191     set gsdlpath=
    192198
    193199
Note: See TracChangeset for help on using the changeset viewer.