[13235] | 1 | @echo off
|
---|
| 2 | set SERVERLANG=en
|
---|
| 3 |
|
---|
[13553] | 4 | :: -------- Run the Greenstone 3 Server --------
|
---|
| 5 |
|
---|
[13235] | 6 | :: This script must be run from within the directory in which it lives
|
---|
| 7 | if exist gs3-server.bat goto start
|
---|
[13553] | 8 | if "%SERVERLANG%" == "en" echo This script must be run from the directory in which it resides.
|
---|
| 9 | if "%SERVERLANG%" == "es" echo Este gui¢n deber ejecutarse desde el directorio en el que reside.
|
---|
| 10 | if "%SERVERLANG%" == "fr" echo Ce script doit Ëtre exâcutâ ⊠partir du râpertoire dans lequel il se trouve.
|
---|
| 11 | if "%SERVERLANG%" == "ru" echo Ââ®â áªà š¯â €®«Š¥ ¡ëâì ¢§ïâ š§ €šà ¥ªâ®à šš, ¢ ª®â®à ®© ® à  á¯®«®Š¥Â
|
---|
[13235] | 12 | goto exit
|
---|
| 13 |
|
---|
[13553] | 14 | :start
|
---|
| 15 | if "%OS%" == "Windows_NT" goto findGSDL
|
---|
| 16 | :: Invoke a new command processor to ensure there's enough environment space
|
---|
| 17 | if "%1" == "Second" goto findGSDL
|
---|
| 18 | command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
| 19 | goto done
|
---|
| 20 |
|
---|
| 21 | :findGSDL
|
---|
[13235] | 22 | echo.
|
---|
[13553] | 23 | if "%SERVERLANG%" == "en" echo Greenstone3 Server
|
---|
| 24 | if "%SERVERLANG%" == "en" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
|
---|
| 25 | if "%SERVERLANG%" == "en" echo This program comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt
|
---|
| 26 | if "%SERVERLANG%" == "en" echo This is free software, and you are welcome to redistribute it
|
---|
[13235] | 27 |
|
---|
| 28 | echo.
|
---|
[13553] | 29 | :: ---- Determine GSDL3HOME ----
|
---|
[13235] | 30 | set GSDL3PATH=
|
---|
| 31 |
|
---|
| 32 | :: Some users may set the above line manually
|
---|
[13553] | 33 | if not "%GSDL3PATH%" == "" goto prepGSDL
|
---|
[13235] | 34 |
|
---|
[13553] | 35 | :: The default location is the current directory
|
---|
| 36 | set GSDL3PATH=.
|
---|
[13235] | 37 |
|
---|
[13553] | 38 | :: If it is set, use the GSDLHOME environment variable
|
---|
| 39 | if "%GSDL3SRCHOME%" == "" goto prepGSDL
|
---|
| 40 | set GSDL3PATH=%GSDL3SRCHOME%
|
---|
[13235] | 41 |
|
---|
| 42 | :prepGSDL
|
---|
| 43 | :: Setup Greenstone, unless it has already been done
|
---|
| 44 | if not "%GSDL3SRCHOME%" == "" goto doneGSDL
|
---|
| 45 | call "%GSDL3PATH%\gs3-setup.bat" SetEnv > nul
|
---|
| 46 |
|
---|
| 47 | :doneGSDL
|
---|
| 48 | :: GSDL3PATH is no longer needed, since GSDL3SRCHOME should now be set
|
---|
| 49 | set GSDL3PATH=
|
---|
| 50 |
|
---|
[13553] | 51 | :findJava
|
---|
[13235] | 52 | :: ---- Check Java exists ----
|
---|
[13614] | 53 | set JAVAPATH=
|
---|
[13235] | 54 |
|
---|
| 55 | :: Some users may set the above line manually
|
---|
| 56 | if not "%JAVAPATH%" == "" goto testJava
|
---|
| 57 |
|
---|
[13553] | 58 | :: If it is set, use the JAVA_HOME environment variable
|
---|
| 59 | if not "%JAVA_HOME%" == "" goto javahome
|
---|
[13235] | 60 |
|
---|
[13553] | 61 | :: Check if Java is on the search path
|
---|
| 62 | echo %PATH%| winutil\which.exe java.exe | winutil\setvar.exe JAVAPATH > setjava.bat
|
---|
| 63 | call setjava.bat
|
---|
| 64 | del setjava.bat
|
---|
| 65 | if not "%JAVAPATH%" == "" goto testJava
|
---|
[13235] | 66 |
|
---|
| 67 | :: Still haven't found anything, so try looking in the registry (gulp!)
|
---|
| 68 | type nul > jdk.reg
|
---|
| 69 | regedit /E jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"
|
---|
| 70 | type jdk.reg > jdk.txt
|
---|
| 71 | del jdk.reg
|
---|
| 72 | type nul > jre.reg
|
---|
| 73 | regedit /E jre.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"
|
---|
| 74 | type jre.reg > jre.txt
|
---|
| 75 | del jre.reg
|
---|
| 76 |
|
---|
| 77 | winutil\findjava.exe jdk.txt jre.txt | winutil\setvar.exe JAVAPATH > setjava.bat
|
---|
| 78 | del jdk.txt
|
---|
| 79 | del jre.txt
|
---|
| 80 | call setjava.bat
|
---|
| 81 | del setjava.bat
|
---|
| 82 |
|
---|
| 83 | :: If nothing was found in the registry, we're stuck
|
---|
| 84 | if "%JAVAPATH%" == "" goto noJava
|
---|
| 85 |
|
---|
| 86 | set JAVAPATH=%JAVAPATH%\bin
|
---|
| 87 | goto testJava
|
---|
| 88 |
|
---|
| 89 | :javahome
|
---|
| 90 | set JAVAPATH=%JAVA_HOME%\bin
|
---|
| 91 |
|
---|
| 92 | :testJava
|
---|
| 93 | :: Check that a Java executable has been found
|
---|
[13553] | 94 | if "%SERVERLANG%" == "en" echo Checking Java: %JAVAPATH%
|
---|
| 95 | if "%SERVERLANG%" == "es" echo Revisando Java: %JAVAPATH%
|
---|
| 96 | if "%SERVERLANG%" == "fr" echo Vârification de Java: %JAVAPATH%
|
---|
| 97 | if "%SERVERLANG%" == "ru" echo Âà ®¢¥à ª Java: %JAVAPATH%
|
---|
| 98 | if exist "%JAVAPATH%\java.exe" goto checkServer
|
---|
[13235] | 99 |
|
---|
| 100 | :noJava
|
---|
[13553] | 101 | echo.
|
---|
| 102 | if "%SERVERLANG%" == "en" echo Failed to locate an appropriate version of Java. You must install a
|
---|
| 103 | if "%SERVERLANG%" == "en" echo Java Runtime Environment (version 1.4 or greater) before running the
|
---|
| 104 | if "%SERVERLANG%" == "en" echo Greenstone3 Server.
|
---|
| 105 | goto exit
|
---|
[13235] | 106 |
|
---|
| 107 | :checkServer
|
---|
[13553] | 108 | ::---- Check that the server program has been compiled ----
|
---|
[13235] | 109 | if exist "server.jar" goto runServer
|
---|
[13553] | 110 | if "%SERVERLANG%" == "en" echo "You need to compile the code before running the server"
|
---|
[13235] | 111 | goto exit
|
---|
| 112 |
|
---|
| 113 | :runServer
|
---|
| 114 | echo Running the Greenstone Server
|
---|
| 115 | :: -Xms32M To set minimum memory
|
---|
| 116 | :: -Xmx32M To set maximum memory
|
---|
| 117 | :: -verbose:gc To set garbage collection messages
|
---|
| 118 | :: -Xincgc For incremental garbage collection
|
---|
| 119 | :: -Xprof Function call profiling
|
---|
| 120 | :: -Xloggc:<file> Write garbage collection log
|
---|
| 121 |
|
---|
| 122 | "%JAVAPATH%\java" -cp %CLASSPATH% org.greenstone.server.Server "%GSDL3SRCHOME%"
|
---|
| 123 |
|
---|
[13553] | 124 | :exit
|
---|
[13235] | 125 |
|
---|
[13553] | 126 | :done
|
---|
| 127 | :: ---- Clean up ----
|
---|
| 128 | set JAVAPATH=
|
---|
| 129 |
|
---|
| 130 |
|
---|
| 131 |
|
---|
[13235] | 132 | |
---|