Changeset 20262 for gsdl/trunk/gsicontrol.bat
- Timestamp:
- 2009-08-14T20:14:24+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/gsicontrol.bat
r20184 r20262 2 2 3 3 setlocal 4 set testdone=04 ::set testdone=0 5 5 set target=%1 6 6 set configfile=%2 7 8 :: Construct the signal using the unique GS2 installation 9 :: directory (after replacing colons and backslashes) 10 for /F "delims=*" %%T in ('"echo %GSDLHOME%| bin\windows\sed.exe s@[\\:]@_@g"') do set signal=%%T 11 set GS2_APACHE_HTTPD_SIGNAL=GS2_APACHE_HTTPD_%signal% 12 rem echo Signal is: %GS2_APACHE_HTTPD_SIGNAL% 7 13 8 14 :: Need to get greenstone installation directory … … 15 21 :: check that we have >=1 and <=2 arguments 16 22 :chkargs 17 if "%target%" == "" goto :usage18 if not "%3" == "" goto :usage23 if "%target%" == "" goto usage 24 if not "%3" == "" goto usage 19 25 goto begincmd 20 26 … … 27 33 echo web-stop 28 34 echo web-restart 35 ::echo web-status 36 ::echo web-graceful 29 37 echo configure-admin 30 38 echo configure-web [config-filename] 31 39 echo configure-apache [config-filename] 32 40 echo configure-cgi 33 34 ::echo web-status 35 ::echo web-graceful 36 ::echo test-gsdlhome 37 ::echo web-stop-tested 41 echo test-gsdlhome 42 echo web-stop-tested 38 43 echo. 39 44 goto exit … … 57 62 ::MAIN MENU 58 63 :commands 64 echo. 65 echo Using: 66 echo GSDLHOME = %GSDLHOME% 67 echo GSDLOS = %GSDLOS% 68 echo. 69 59 70 if "%target%" == "web-start" goto start 60 71 if "%target%" == "web-stop" goto stop 61 72 if "%target%" == "web-restart" goto restart 62 if "%target%" == "web-status" goto status63 if "%target%" == "web-graceful" goto graceful73 rem if "%target%" == "web-status" goto status 74 rem if "%target%" == "web-graceful" goto graceful 64 75 if "%target%" == "configure-admin" goto cfgadmin 65 76 if "%target%" == "configure-web" goto cfgweb 66 77 if "%target%" == "configure-apache" goto cfgapach 67 78 if "%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 80 if "%target%" == "test-gsdlhome" goto exit 81 rem if "%target%" == "web-stop-tested" goto exit 69 82 if "%target%" == "portcon" goto portcon1 70 83 :: unknown command 84 echo Command unrecognised: %target% 71 85 goto usage 72 86 … … 74 88 :: START starts the app in a new console named by the string following immediately thereafter 75 89 :: 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"90 START "%GSDLHOME%\apachectl" "%GSDLHOME%\bin\windows\starthttpd.exe" %GS2_APACHE_HTTPD_SIGNAL% "%GSDLHOME%\apache-httpd\windows\bin\httpd.exe" 77 91 echo %MONITOR_SUCCESS% 78 92 echo %MONITOR_FINISHED% … … 80 94 81 95 :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 97 if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" %GS2_APACHE_HTTPD_SIGNAL% 98 if "%target%" == "web-stop-tested" goto exit 84 99 echo %MONITOR_SUCCESS% 85 echo %MONITOR_FINISHED% 100 echo %MONITOR_FINISHED% 86 101 goto exit 87 102 88 103 :restart 89 if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" GS2_APACHE_HTTPD90 :: wait 2s, see http://malektips.com/dos0017.html. The 2 in the 2nd line is variable104 if 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) 91 106 ping 127.0.0.1 -n 2 -w 1000 > nul 92 ping 127.0.0.1 -n 2-w 1000> nul93 ::"%GSDLHOME%\bin\windows\starthttpd.exe" GS2_APACHE_HTTPD"%GSDLHOME%\apache-httpd\windows\bin\httpd.exe"107 ping 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" 94 109 goto start 95 110 … … 97 112 :graceful 98 113 ::echo Command %target% is not yet operational (no local apache web server included in this release). 99 goto exit100 101 :stoptest102 if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" GS2_APACHE_HTTPD103 rem if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\apache-httpd\%GSDLOS%\bin\apachectl" stop104 114 goto exit 105 115 … … 110 120 if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" goto cgimsg 111 121 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 116 124 set safepath= 117 125 goto cgifin … … 130 138 ::configure-apache 131 139 :cfgapach 132 if exist "%GSDLHOME%\llssite.cfg" goto :exit133 if not exist "%GSDLHOME%\llssite.cfg.in" goto :exit140 if exist "%GSDLHOME%\llssite.cfg" goto exit 141 if not exist "%GSDLHOME%\llssite.cfg.in" goto exit 134 142 copy llssite.cfg.in llssite.cfg 135 143 set configfile="%GSDLHOME%\llssite.cfg" … … 159 167 echo Did not set password 160 168 ) 169 echo. 161 170 goto exit 162 171 … … 170 179 171 180 :portcon2 172 if "%port%" == "" goto exit181 if "%port%" == "" echo Done& goto exit 173 182 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 176 184 177 185 echo Port: %port% 178 186 echo Stopping web server (if running) 179 if not exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" echo missing conf file180 if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" GS2_APACHE_HTTPDSILENT187 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 181 189 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.cfg183 190 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" 184 191 echo Type '%0 web-start' to start the web server running on port %port% … … 189 196 set _sed= 190 197 set safepath= 191 set gsdlpath=192 198 193 199
Note:
See TracChangeset
for help on using the changeset viewer.