source: gsdl/trunk/gs2-server.sh@ 19023

Last change on this file since 19023 was 19023, checked in by ak19, 15 years ago
  1. gsicontrol.sh target configure-apache generates the llssite.cfg file from the llssite.cfg.in template file if one didn't already exist. 2. Before launching server.jar, GS2-server.sh creates the llssite.cfg file from the template llssite.cfg.in file if it did not exist yet. This needs to be done before server.jar is called because that will exit if the file does not exist on startup.
  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/bash
2serverlang=en
3
4java_min_version=1.4.0_00
5
6function autoset_gsdl_home() {
7
8 # remove leading ./ if present
9 prog=${0#./}
10
11 isrelative=${prog%%/*}
12
13 if [ ! -z $isrelative ] ; then
14 # some text is left after stripping
15 # => is relative
16 pwd=$PWD
17 prog="$pwd/$prog"
18 fi
19
20 fulldir=${prog%/*}
21
22 # remove trailing /. if present
23 eval $1=${fulldir%/.}
24}
25
26function isinpath() {
27 for file in `echo $1 | sed 's/:/ /g'`; do
28 if [ "$file" == "$2" ]; then
29 echo true
30 return
31 fi
32 done
33 echo false
34}
35
36
37echo "Greenstone 2 Server"
38echo "Copyright (C) 2009, New Zealand Digital Library Project, University Of Waikato"
39echo "This software comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
40echo "This is free software, and you are welcome to redistribute it"
41
42## -------- Run the Greenstone 2 Server --------
43
44
45## ---- Determine GSDLHOME ----
46gsdl2path=
47
48# Some users may set the above line manually
49if [ -z "$gsdl2path" ]; then
50 autoset_gsdl_home gsdl2path
51fi
52
53# Setup Greenstone2, unless it has already been done
54if [ -z "$GSDLHOME" ]; then
55 pushd $gsdl2path > /dev/null
56 source setup.bash
57 popd > /dev/null
58fi
59
60# If there's no llssite.cfg file, copy from the template
61if [ ! -e "$GSDLHOME/llssite.cfg" ]; then
62 if [ -e "$GSDLHOME/llssite.cfg.in" ]; then
63 cp "$GSDLHOME/llssite.cfg.in" "$GSDLHOME/llssite.cfg"
64 else
65 echo "Warning: could not find llssite.cfg.in to create llssite.cfg from."
66 fi
67fi
68
69
70# JRE_HOME or JAVA_HOME must be set correctly to run this program
71search4j -m $java_min_version &> /dev/null
72if [ "$?" == "0" ]; then
73 # In Java code, '...getResourceAsStream("build.properties")'
74 # needs up to be in the right directory when run
75 pushd $gsdl2path > /dev/null
76
77
78 #CLASSPATH
79 if [ `isinpath "$CLASSPATH" "$GSDLHOME/lib/java"` == "false" ]; then
80 CLASSPATH=$GSDLHOME/lib/java:$CLASSPATH
81 for JARFILE in $GSDLHOME/lib/java/*.jar; do
82 CLASSPATH=$CLASSPATH:$JARFILE
83 done
84 export CLASSPATH
85
86 echo " - Adjusted CLASSPATH"
87 else
88 echo " - CLASSPATH already correct"
89 fi
90
91 javapath=`search4j -m $java_min_version -e`
92 $javapath org.greenstone.server.Server2 $GSDLHOME $serverlang $*
93
94 popd > /dev/null
95fi
96
Note: See TracBrowser for help on using the repository browser.