1 | #!/bin/sh
|
---|
2 | serverlang=en
|
---|
3 |
|
---|
4 | echo
|
---|
5 | echo "Greenstone 3 Server"
|
---|
6 | echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
|
---|
7 | echo "This software comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
|
---|
8 | echo "This is free software, and you are welcome to redistribute it"
|
---|
9 | echo
|
---|
10 |
|
---|
11 | ## -------- Run the Greenstone 3 Server --------
|
---|
12 |
|
---|
13 | # This script must be run from within the directory in which it lives
|
---|
14 | thisdir=`pwd`
|
---|
15 | if [ ! -f "${thisdir}/gs3-server.sh" ]; then
|
---|
16 | if [ "$serverlang" == "es" ]; then
|
---|
17 | echo "Este guión deberá ejecutarse desde el directorio en el que reside."
|
---|
18 | elif [ "$serverlang" == "fr" ]; then
|
---|
19 | echo "Ce script doit être exécuté à partir du répertoire dans lequel il se trouve."
|
---|
20 | elif [ "$serverlang" == "ru" ]; then
|
---|
21 | echo "üÔÏÔ ÓËÒÉÐÔ ÄÏÌÖÅÎ ÂÙÔØ ×ÚÑÔ ÉÚ ÄÉÒÅËÔÏÒÉÉ, × ËÏÔÏÒÏÊ ÏÎ ÒÁÓÐÏÌÏÖÅÎ"
|
---|
22 | else
|
---|
23 | echo "This script must be run from the directory in which it resides."
|
---|
24 | fi
|
---|
25 | exit 1
|
---|
26 | fi
|
---|
27 |
|
---|
28 |
|
---|
29 | ## ---- Determine GSDL3SRCHOME ----
|
---|
30 | gsdl3path=
|
---|
31 |
|
---|
32 | # Some users may set the above line manually
|
---|
33 | if [ "x$gsdl3path" == "x" ]; then
|
---|
34 | # Check the environment variable first
|
---|
35 | if [ "x$GSDL3SRCHOME" != "x" ]; then
|
---|
36 | gsdl3path=$GSDL3SRCHOME
|
---|
37 | else
|
---|
38 | gsdl3path=`pwd`
|
---|
39 | fi
|
---|
40 | fi
|
---|
41 |
|
---|
42 | # Setup Greenstone3, unless it has already been done
|
---|
43 | if [ "x$GSDL3SRCHOME" == "x" ]; then
|
---|
44 | pushd $gsdl3path > /dev/null
|
---|
45 | source gs3-setup.sh
|
---|
46 | popd > /dev/null
|
---|
47 | fi
|
---|
48 |
|
---|
49 | ## ---- Check Java exists ----
|
---|
50 | javapath=
|
---|
51 |
|
---|
52 | # Some users may set the above line manually
|
---|
53 | if [ "x$javapath" = "x" ]; then
|
---|
54 |
|
---|
55 | # If it is set, use the JAVA_HOME environment variable
|
---|
56 | if [ "x$JAVA_HOME" != "x" ]; then
|
---|
57 | javapath="$JAVA_HOME/bin/java"
|
---|
58 |
|
---|
59 | # Check if Java is on the search path
|
---|
60 | else
|
---|
61 | javapath=`which java 2> /dev/null`
|
---|
62 | fi
|
---|
63 | fi
|
---|
64 |
|
---|
65 | # Check that a Java executable has been found
|
---|
66 | if [ "$glilang" = "es" ]; then
|
---|
67 | echo "Revisando Java: $javapath"
|
---|
68 | elif [ "$glilang" = "fr" ]; then
|
---|
69 | echo "V<E9>rification de Java: $javapath"
|
---|
70 | elif [ "$glilang" = "ru" ]; then
|
---|
71 | echo "<F0><D2><CF><D7><C5><D2><CB><C1> Java: $javapath"
|
---|
72 | else
|
---|
73 | echo "Checking Java: $javapath"
|
---|
74 | fi
|
---|
75 | if [ ! -x "$javapath" ]; then
|
---|
76 | echo
|
---|
77 | echo "Failed to locate an appropriate version of Java. You must installa"
|
---|
78 | echo "Java Runtime Environment (version 1.4 or greater) before running the"
|
---|
79 | echo "Greenstone Server."
|
---|
80 | exit 1
|
---|
81 | fi
|
---|
82 |
|
---|
83 | ## -- Check the version of Java is new enough (1.4.0 or higher) to run the Server -- do we need this?
|
---|
84 | #`$javapath -classpath . CheckJavaVersion > /dev/null`
|
---|
85 | #if [ $? -ne 2 ] ; then
|
---|
86 | # echo "The version of the Java Runtime Environment you have installed is too"
|
---|
87 | # echo "old to run the Greenstone Librarian Interface. Please install a new"
|
---|
88 | # echo "version of the JRE (version 1.4 or newer) and rerun this script."
|
---|
89 | #exit 1
|
---|
90 | #fi
|
---|
91 |
|
---|
92 | ## ---- Check that the server has been compiled ----
|
---|
93 | if [ ! -f server.jar ]; then
|
---|
94 | echo "You need to compile the server before running this script"
|
---|
95 | exit 1
|
---|
96 | fi
|
---|
97 |
|
---|
98 |
|
---|
99 | # Other arguments you can provide to java
|
---|
100 | # -Xms<number>M To set minimum memory (by default 32MB)
|
---|
101 | # -Xmx<number>M To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
|
---|
102 | # -verbose:gc To set garbage collection messages
|
---|
103 | # -Xincgc For incremental garbage collection (significantly slows performance)
|
---|
104 | # -Xprof Function call profiling
|
---|
105 | # -Xloggc:<file> Write garbage collection log
|
---|
106 |
|
---|
107 | java -cp $CLASSPATH org.greenstone.server.Server $GSDL3SRCHOME
|
---|