blob: 3a68fe8a0c244cca56f793901dedd0f2e0a13953 [file] [log] [blame]
Hongqing Liufd5ee812014-05-10 16:32:51 +08001#!/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# Start Script for the CATALINA Server
20# -----------------------------------------------------------------------------
21
22# Better OS/400 detection: see Bugzilla 31132
23os400=false
24darwin=false
25case "`uname`" in
26CYGWIN*) cygwin=true;;
27OS400*) os400=true;;
28Darwin*) darwin=true;;
29esac
30
31# resolve links - $0 may be a softlink
32PRG="$0"
33
34while [ -h "$PRG" ] ; do
35 ls=`ls -ld "$PRG"`
36 link=`expr "$ls" : '.*-> \(.*\)$'`
37 if expr "$link" : '/.*' > /dev/null; then
38 PRG="$link"
39 else
40 PRG=`dirname "$PRG"`/"$link"
41 fi
42done
43
44PRGDIR=`dirname "$PRG"`
45EXECUTABLE=catalina.sh
46
47# Check that target executable exists
48if $os400; then
49 # -x will Only work on the os400 if the files are:
50 # 1. owned by the user
51 # 2. owned by the PRIMARY group of the user
52 # this will not work if the user belongs in secondary groups
53 eval
54else
55 if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
56 echo "Cannot find $PRGDIR/$EXECUTABLE"
57 echo "The file is absent or does not have execute permission"
58 echo "This file is needed to run this program"
59 exit 1
60 fi
61fi
62
63exec "$PRGDIR"/"$EXECUTABLE" start "$@"