Changeset 19970
- Timestamp:
- 2009-07-08T14:47:08+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/gsicontrol.bat
r19290 r19970 1 1 @echo off 2 2 3 setlocal 3 4 set testdone=0 4 5 set target=%1 5 6 set configfile=%2 6 7 7 set MONITOR_SUCCESS="MAKE SUCCESSFUL" 8 set MONITOR_FAILED="MAKE FAILED" 9 set MONITOR_FINISHED="MAKE DONE" 8 :: Need to get greenstone installation directory 9 :: set cwd=%CD% 10 11 set MONITOR_SUCCESS=MAKE SUCCESSFUL 12 set MONITOR_FAILED=MAKE FAILED 13 set MONITOR_FINISHED=MAKE DONE 10 14 11 15 :: check that we have >=1 and <=2 arguments … … 20 24 echo Usage: %0 command 21 25 echo where command is any of the following: 22 ::echo web-start 23 ::echo web-stop 24 ::echo web-restart 25 ::echo web-status 26 ::echo web-graceful 26 echo web-start 27 echo web-stop 28 echo web-restart 27 29 echo configure-admin 28 30 echo configure-web [config-filename] 29 31 echo configure-apache [config-filename] 30 32 echo configure-cgi 33 34 ::echo web-status 35 ::echo web-graceful 31 36 ::echo test-gsdlhome 32 37 ::echo web-stop-tested … … 62 67 if "%target%" == "configure-cgi" goto cfgcgi 63 68 if "%target%" == "test-gsdlhome" goto testgsdl 69 if "%target%" == "portcon" goto portcon1 64 70 :: unknown command 65 71 goto usage 66 72 67 73 :start 74 "%GSDLHOME%\bin\windows\starthttpd.exe" GS2_APACHE_HTTPD "%GSDLHOME%\apache-httpd\windows\bin\httpd.exe" 75 echo %MONITOR_SUCCESS% 76 echo %MONITOR_FINISHED% 77 goto exit 78 68 79 :stop 80 if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" GS2_APACHE_HTTPD 81 rem if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\apache-httpd\%GSDLOS%\bin\apachectl" stop 82 echo %MONITOR_SUCCESS% 83 echo %MONITOR_FINISHED% 84 goto exit 85 69 86 :restart 87 if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" GS2_APACHE_HTTPD 88 :: wait 2s, see http://malektips.com/dos0017.html. The 2 in the 2nd line is variable 89 ping 127.0.0.1 -n 2 -w 1000 > nul 90 ping 127.0.0.1 -n 2 -w 1000> nul 91 ::"%GSDLHOME%\bin\windows\starthttpd.exe" GS2_APACHE_HTTPD "%GSDLHOME%\apache-httpd\windows\bin\httpd.exe" 92 goto start 93 70 94 :status 71 95 :graceful 72 :stoptest 73 echo Command %target% is not yet operational (no local apache web server included in this release). 96 ::echo Command %target% is not yet operational (no local apache web server included in this release). 74 97 goto exit 75 98 76 rem :stoptest 99 :stoptest 100 if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" GS2_APACHE_HTTPD 77 101 rem if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\apache-httpd\%GSDLOS%\bin\apachectl" stop 78 remgoto exit102 goto exit 79 103 80 104 ::configure-web … … 82 106 :cfgweb 83 107 :cfgcgi 84 if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" echo WARNING: Nothing done for make configure-cgi. 85 if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" echo If you wish to regenerate the file 86 if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" echo %GSDLHOME%\cgi-bin\gsdlsite.cfg 87 if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" echo from scratch, delete the existing file first. 88 if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" goto cgifin 108 if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" goto cgimsg 89 109 echo Configuring cgi-bin\gsdlsite.cfg 90 110 set gsdlpath=%GSDLHOME% … … 93 113 set gsdlpath= 94 114 set safepath= 115 goto cgifin 116 117 :cgimsg 118 echo WARNING: Nothing done for make configure-cgi. 119 echo If you wish to regenerate the file 120 echo %GSDLHOME%\cgi-bin\gsdlsite.cfg 121 echo from scratch, delete the existing file first. 122 echo. 95 123 96 124 :cgifin 97 echo.98 125 if "%target%" == "configure-cgi" goto exit 99 126 if "%target%" == "configure-web" goto cfgapach … … 115 142 :: Have to create an intermediate file in the following, because echoing 116 143 :: lines straight into a pipe adds spaces before the end of each line. 117 :: When piping need to double escape angle brackets with three hat signs,144 :: When piping, need to double-escape the angle brackets with three hat signs, 118 145 :: but when redirecting to a file, need to escape only once (one hat sign). 119 146 if ERRORLEVEL 0 ( … … 132 159 goto exit 133 160 161 ::configure-port-and-connection 162 :portcon1 163 set /p port=Enter port number to use: 164 set /p connect=Allow external connections [yes/no]: 165 if "%connect%" == "yes" set allowfrom="all" goto portcon2 166 if "%connect%" == "y" set allowfrom="all" goto portcon2 167 set allowfrom="127.0.0.1" 168 169 :portcon2 170 if "%port%" == "" goto exit 171 set _sed="bin\windows\sed.exe" 172 set gsdlpath=%GSDLHOME% 173 for /F "delims=*" %%T in ('"echo %gsdlpath%| bin\windows\sed.exe s@\\@\/@g"') do set safepath=%%T 174 175 echo Port: %port% 176 echo Stopping web server (if running) 177 if not exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" echo missing conf file 178 if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" GS2_APACHE_HTTPD 179 echo Setting config file to use port %port% 180 bin\windows\sed.exe "s@\*\*GSDLHOME\*\*@\"%safepath%\"@g" cgi-bin/gsdlsite.cfg.in > cgi-bin/gsdlsite.cfg 181 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" 182 echo Type '%0 web-start' to start the web server running on port %port% 183 echo Done 184 set port= 185 set connect= 186 set allowfrom= 187 set _sed= 188 set safepath= 189 set gsdlpath= 190 134 191 135 192 :exit 136 set testdone= 137 set target= 138 set configfile= 139 set MONITOR_SUCCESS= 140 set MONITOR_FAILED= 141 set MONITOR_FINISHED= 193 endlocal
Note:
See TracChangeset
for help on using the changeset viewer.