source: trunk/gsdl3/gsdl3.sh@ 6370

Last change on this file since 6370 was 6342, checked in by kjdon, 20 years ago

a startup script to get greenstone running

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1#!/bin/sh
2
3echo
4echo "Greenstone 3 (GSDL3)"
5echo "Copyright (C) 2003 New Zealand Digital Libraries, University Of Waikato"
6echo "GSDL3 comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
7echo "This is free software, and you are welcome to redistribute it"
8echo
9
10## -------- setup.bash --------
11
12if [ ! -f setup.bash ]; then
13 echo "You must source the script from within the Greenstone home directory"
14 exit 1
15fi
16
17GSDL3HOME=`pwd`
18export GSDL3HOME
19
20GSDLOS=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
21# check for running bash under cygwin
22if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ; then
23 GSDLOS=windows
24fi
25export GSDLOS
26
27PATH=$GSDL3HOME/packages/mysql/bin:$GSDL3HOME/bin/script:$GSDL3HOME/bin:$PATH
28export PATH
29MANPATH=$MANPATH:$GSDL3HOME/doc/man
30export MANPATH
31
32CLASSPATH=$GSDL3HOME/resources/java:$GSDL3HOME/resources/dtd:$GSDL3HOME/src/java:$GSDL3HOME/comms/jakarta/tomcat/common/lib/servlet.jar
33for JARFILE in $GSDL3HOME/lib/java/*; do
34 CLASSPATH=$CLASSPATH:$JARFILE
35done
36export CLASSPATH
37
38LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GSDL3HOME/lib
39export LD_LIBRARY_PATH
40
41#set up java options for catalina
42CATALINA_OPTS="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DGSDLHOME=$GSDLHOME -DPATH=$PATH"
43export CATALINA_OPTS
44
45# Make sure JAVA_HOME is set
46if test ! -n "$JAVA_HOME" ; then
47 echo "Error: JAVA_HOME variable not set."
48 exit 1
49# Make sure the Java executable is in JAVA_HOME/bin/
50elif test ! -f "$JAVA_HOME/bin/java"; then
51 echo "Error: Java executable not found."
52 exit 1
53# Make sure the Java version is 1.4 (should really check for 1.4 or higher)
54elif test ! -n "`$JAVA_HOME/bin/java -version 2>&1 | grep 'version \"1.4'`" ; then
55 echo "Error: Java version 1.4+ required."
56 exit 1
57else
58 echo "Your environment has successfully been set up to run Greenstone3"
59 if test ! -n "$GSDLHOME" ; then
60 echo "However, if you want to run greenstone 2 compatible building, then you need to 'source setup.bash' in the home directory of your greenstone 2 installation, and then re-source this script"
61 fi
62 echo ""
63fi
64
65
66if [ "$1" != "-shutdown" ]; then
67
68 ## -------- Run MySQL --------
69
70 echo "Starting MySQL Daemon..."
71 echo "NOT!"
72
73 ## -------- Run Tomcat --------
74
75 echo "Starting Tomcat Webserver..."
76 echo ""
77 pushd $GSDL3HOME/comms/jakarta/tomcat/bin
78 ./startup.sh
79 popd
80 echo "Done. It will be ready in a few minutes."
81
82 ## -------- Greenstone 3 --------
83
84 echo ""
85 echo "****************************************************************"
86 echo "Greenstone collections will start being served in several"
87 echo "minutes. Use your browser to view the Greenstone collections by"
88 echo "choosing to:"
89 echo ""
90 echo " 'run the library servlet'"
91 echo ""
92 echo "from the page shown at:"
93 echo ""
94 echo " http://localhost:8080/gsdl3"
95 echo ""
96 echo "To cease serving greenstone collections please run this file"
97 echo "again but provide the shutdown argument like so:"
98 echo ""
99 echo " gsdl3.sh -shutdown"
100 echo ""
101 echo "****************************************************************"
102 echo ""
103
104else
105
106 ## -------- Stop Tomcat --------
107
108 echo "Shutting Down Tomcat Webserver..."
109 echo ""
110 pushd $GSDL3HOME/comms/jakarta/tomcat/bin
111 ./shutdown.sh
112 popd
113 echo "Done."
114
115 ## -------- Stop MySQL --------
116
117 echo "Stop MySQL Daemon..."
118 echo "Not running."
119
120 ## -------- Greenstone 3 --------
121 echo "****************************************************************"
122 echo "Greenstone 3 has been shutdown. Run gsdl3 to restart."
123 echo "****************************************************************"
124
125fi
126
127exit 0
Note: See TracBrowser for help on using the repository browser.