source: main/trunk/greenstone3/gs3-server.sh

Last change on this file was 38417, checked in by anupama, 5 months ago

Dr Bainbridge pointed out that the gs3-server script should source the new SETUP script instead of the gs3-setup script, as SETUP will source cli extensions besides sourcing the gs3-setup script. We also need gs3-server.bat to do the same, for which we need a SETUP.bat first.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1#!/bin/bash
2serverlang=en
3
4java_min_version=1.4.0_00
5
6autoset_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
26check_gsdl3home_writable() {
27
28 echo "Checking if the Greenstone3 web directory is writable ..."
29 (echo "This is a temporary file. It is safe to delete it." > "$GSDL3HOME/testing.tmp" ) 2>/dev/null
30 if [ -e "$GSDL3HOME/testing.tmp" ] ; then
31 /bin/rm "$GSDL3HOME/testing.tmp"
32 gsdl3home_isreadonly=0
33 echo " ... yes."
34 else
35 gsdl3home_isreadonly=1
36 gsdl3_writablehome="/tmp/greenstone/web"
37
38 echo " ... no."
39 echo "Setting Greenstone3 web home writable area to be: $gsdl3_writablehome"
40
41
42# if [ ! -d "$gsdl3_writablehome" ] ; then
43# echo "Creating the directory: $gsdl3_writablehome"
44
45# mkdir -p "$gsdl3_writablehome"
46# mkdir -p "$gsdl3_writablehome/packages"
47# mkdir -p "$gsdl3_writablehome/logs"
48# mkdir -p "$gsdl3_writablehome/ext/solr"
49
50# chmod a+rwx "$gsdl3_writablehome"
51# chmod a+rwx "$gsdl3_writablehome/packages"
52# chmod a+rwx "$gsdl3_writablehome/logs"
53# chmod a+rwx "$gsdl3_writablehome/ext/solr"
54
55## echo "Copying to $gsdl3_writablehome/packages/tomcat"
56## /bin/cp -r "$GSDL3SRCHOME/packages/tomcat" "$gsdl3_writablehome/packages/."
57
58## echo "=> Copying Greenstone's web/WEB-INF to writable area"
59
60## gsdl3_home=$GSDL3HOME
61## /bin/cp -r "$gsdl3_home/WEB-INF" "$gsdl3_writablehome/."
62## /bin/cp -r "$gsdl3_home/index.html" "$gsdl3_writablehome/."
63## fi
64 fi
65}
66
67echo "Greenstone 3 Server"
68echo "Copyright (C) 2009, New Zealand Digital Library Project, University Of Waikato"
69echo "This software comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
70echo "This is free software, and you are welcome to redistribute it"
71
72## -------- Run the Greenstone 3 Server --------
73
74
75## ---- Determine GSDL3SRCHOME ----
76gsdl3path=
77
78# Some users may set the above line manually
79if [ -z "$gsdl3path" ]; then
80 autoset_gsdl_home "gsdl3path"
81fi
82
83# Setup Greenstone3
84pushd $gsdl3path > /dev/null
85#source ./gs3-setup.sh
86source ./SETUP.bash
87popd > /dev/null
88
89
90check_gsdl3home_writable
91
92opt_properties=
93if [ $gsdl3home_isreadonly = 1 ] ; then
94 opt_properties="-Dgsdl3home.isreadonly=true -Dgsdl3.writablehome=$gsdl3_writablehome"
95else
96 opt_properties="-Dgsdl3.writablehome=$GSDL3HOME"
97fi
98
99# Calling ant target to initialize the gsdl3-writablehome area (if it doesn't already exist)
100# ... including the all important global.properties.
101
102ant $opt_properties configure-web
103
104
105# JRE_HOME or JAVA_HOME must be set correctly to run this program
106PRIORITY_HINT="`pwd`/packages/jre"
107if [ "$GSDLOS" = "darwin" ]; then
108 # On mac, when double clicking the gs3-server.app icon, the current working dir is not $GSDL3SRCHOME
109 if [ ! -d "$PRIORITY_HINT" ]; then
110 PRIORITY_HINT="$GSDL3SRCHOME/packages/jre"
111 fi
112 if [ ! -d "$PRIORITY_HINT" ]; then
113 PRIORITY_HINT=`/usr/libexec/java_home`
114 fi
115
116 # set the mac icon for when launching this script manually
117 if [ -f "$GSDL3SRCHOME/gs3-server.app/Contents/Resources/ApplicationStub.icns" ]; then
118 opt_properties="$opt_properties -Xdock:icon=gs3-server.app/Contents/Resources/ApplicationStub.icns"
119 fi
120fi
121
122javapath=`search4j -p "$PRIORITY_HINT" -m $java_min_version -e`
123if [ "$?" == "0" ]; then
124 # In Java code, '...getResourceAsStream("build.properties")'
125 # needs up to be in the right directory when run
126 pushd "$gsdl3path" > /dev/null
127
128 "$javapath" $opt_properties org.greenstone.server.Server3 "$GSDL3SRCHOME" $serverlang
129
130 popd > /dev/null
131fi
Note: See TracBrowser for help on using the repository browser.