source: nutchez-0.1/tomcat/bin/tool-wrapper.sh @ 222

Last change on this file since 222 was 66, checked in by waue, 16 years ago

NutchEz - an easy way to nutch

  • Property svn:executable set to *
File size: 3.2 KB
Line 
1#!/bin/sh
2
3# Licensed to the Apache Software Foundation (ASF) under one or more
4# contributor license agreements.  See the NOTICE file distributed with
5# this work for additional information regarding copyright ownership.
6# The ASF licenses this file to You under the Apache License, Version 2.0
7# (the "License"); you may not use this file except in compliance with
8# the License.  You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18# -----------------------------------------------------------------------------
19# Wrapper script for command line tools
20#
21# Environment Variable Prequisites
22#
23#   CATALINA_HOME May point at your Catalina "build" directory.
24#
25#   TOOL_OPTS     (Optional) Java runtime options used when the "start",
26#                 "stop", or "run" command is executed.
27#
28#   JAVA_HOME     Must point at your Java Development Kit installation.
29#
30#   JAVA_OPTS     (Optional) Java runtime options used when the "start",
31#                 "stop", or "run" command is executed.
32#
33# $Id: tool-wrapper.sh 562770 2007-08-04 22:13:58Z markt $
34# -----------------------------------------------------------------------------
35
36# OS specific support.  $var _must_ be set to either true or false.
37cygwin=false
38case "`uname`" in
39CYGWIN*) cygwin=true;;
40esac
41
42# resolve links - $0 may be a softlink
43PRG="$0"
44
45while [ -h "$PRG" ]; do
46  ls=`ls -ld "$PRG"`
47  link=`expr "$ls" : '.*-> \(.*\)$'`
48  if expr "$link" : '/.*' > /dev/null; then
49    PRG="$link"
50  else
51    PRG=`dirname "$PRG"`/"$link"
52  fi
53done
54
55# Get standard environment variables
56PRGDIR=`dirname "$PRG"`
57CATALINA_HOME=`cd "$PRGDIR/.." ; pwd`
58if [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then
59  . "$CATALINA_HOME"/bin/setenv.sh
60fi
61
62# For Cygwin, ensure paths are in UNIX format before anything is touched
63if $cygwin; then
64  [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
65  [ -n "$CATALINA_HOME" ] && CATALINA_HOME=`cygpath --unix "$CATALINA_HOME"`
66  [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
67fi
68
69# Get standard Java environment variables
70if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
71  BASEDIR="$CATALINA_HOME"
72  . "$CATALINA_HOME"/bin/setclasspath.sh
73else
74  echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"
75  echo "This file is needed to run this program"
76  exit 1
77fi
78
79# Add on extra jar files to CLASSPATH
80CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$BASEDIR"/lib/servlet-api.jar
81
82# For Cygwin, switch paths to Windows format before running java
83if $cygwin; then
84  JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
85  CATALINA_HOME=`cygpath --path --windows "$CATALINA_HOME"`
86  CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
87fi
88
89# ----- Execute The Requested Command -----------------------------------------
90
91exec "$_RUNJAVA" $JAVA_OPTS $TOOL_OPTS \
92  -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
93  -Dcatalina.home="$CATALINA_HOME" \
94  org.apache.catalina.startup.Tool "$@"
Note: See TracBrowser for help on using the repository browser.