Changeset 21966
- Timestamp:
- 2010-04-27T14:39:12+12:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/gs2-server.bat
r20934 r21966 152 152 ) 153 153 echo. 154 "%JAVA_EXECUTABLE%" org.greenstone.server.Server2 "%GSDLHOME%" "%serverlang%" %* 155 ::echo ******* Second argument to gs2-server.bat is: %2 156 :: The 1st argument to gs2-server.bat (if any) would be --config, the 2nd is the config 157 :: filename if it is glisite.cfg, then this script was launched through GLI and would 158 :: have opened a DOS console. Need to exit from this script then to close the console. 159 if "%2" == "%GSDLHOME%\glisite.cfg" goto quitcmd 154 155 :: GLI launches gs2-server.bat with: 156 :: cmd /c start "window" "c:\path to\gs2-server.bat" --config=c:\path to\glisite.cfg [--quit=portnum] 157 :: The configfile param could contain spaces, in which case its space-separated parts spread over 158 :: multiple parameters . Need to handle things the following way, since using quotes to embed the 159 :: parameters breaks the start command, see http://ss64.com/nt/start.html 160 :: This script is launched by the start cmd as: 161 :: "c:\path to\gs2-server.bat" --config=c:\path to\config.cfg [--quit=portnum]. 162 :: But if the parameter following --config=<some string> doesn't start with a double hyphen, we 163 :: assume it to be part of the config parameter, as the configfile path may have contained spaces. 164 165 :: Store all parameters together in config file var: we may or may not have a portnumber 166 :: Get everything after the "--quit=", if anything, and store it in port var. If no port, nothing to do. 167 set conf=%* 168 set port=%conf:*--quitport=% 169 if "%conf%" == "%port%" ( 170 set port= 171 goto :runit 172 ) else ( 173 set port=%port:~1% 174 ) 175 176 :: Because we got here, need to adjust conf by removing " --quitport=" from it and prefixing this to port 177 call set conf=%%conf:%port%=%% 178 set conf=%conf:~0,-12% 179 set port=--quitport=%port% 180 181 :: Remove trailing spaces from conf and port 182 :: (We'll put the all-important quotes around conf and port when the actual java cmd is launched) 183 set tmp=%conf% 184 call :trim %tmp% 185 set conf=%tmp% 186 set tmp=%port% 187 call :trim %port% 188 set port=%tmp% 189 set tmp= 190 191 goto :runit 192 193 :: http://www.computing.net/answers/programming/dos-batch-remove-trailing-space/9270.html 194 :trim 195 set tmp=%* 196 goto :eof 197 198 :runit 199 ::echo port: %port%& echo conf: %conf%& echo.& echo. 200 :: "%JAVA_EXECUTABLE%" org.greenstone.server.Server2 "%GSDLHOME%" "%serverlang%" %* 201 "%JAVA_EXECUTABLE%" org.greenstone.server.Server2 "%GSDLHOME%" "%serverlang%" "%conf%" "%port%" 202 203 204 :: The 1st argument to gs2-server.bat (if any) would be --config, the 2nd is the config filename. 205 :: Both are stored in %conf% now. If the config file is glisite.cfg, then this script was launched through 206 :: GLI and would have opened a DOS console. Need to exit from this script then to close the console. 207 :: Remove --config= prefix and do a case insensitive comparison, since filepaths can have uppercase chars 208 if /i "%conf:~9%" == "%GSDLHOME%\glisite.cfg" goto quitcmd 160 209 goto exit 161 210
Note:
See TracChangeset
for help on using the changeset viewer.