source: greenstone3/branches/customizingGreenstone3/gs3-server.bat@ 14684

Last change on this file since 14684 was 13931, checked in by shaoqun, 14 years ago

make the line ending right

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