Cheng Tang | 697ce24 | 2014-04-27 16:18:17 +0800 | [diff] [blame^] | 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 | # Stop script for the CATALINA Server |
| 20 | # |
| 21 | # $Id: shutdown.sh 1202062 2011-11-15 06:50:02Z mturk $ |
| 22 | # ----------------------------------------------------------------------------- |
| 23 | |
| 24 | # Better OS/400 detection: see Bugzilla 31132 |
| 25 | os400=false |
| 26 | case "`uname`" in |
| 27 | OS400*) os400=true;; |
| 28 | esac |
| 29 | |
| 30 | # resolve links - $0 may be a softlink |
| 31 | PRG="$0" |
| 32 | |
| 33 | while [ -h "$PRG" ] ; do |
| 34 | ls=`ls -ld "$PRG"` |
| 35 | link=`expr "$ls" : '.*-> \(.*\)$'` |
| 36 | if expr "$link" : '/.*' > /dev/null; then |
| 37 | PRG="$link" |
| 38 | else |
| 39 | PRG=`dirname "$PRG"`/"$link" |
| 40 | fi |
| 41 | done |
| 42 | |
| 43 | PRGDIR=`dirname "$PRG"` |
| 44 | EXECUTABLE=catalina.sh |
| 45 | |
| 46 | # Check that target executable exists |
| 47 | if $os400; then |
| 48 | # -x will Only work on the os400 if the files are: |
| 49 | # 1. owned by the user |
| 50 | # 2. owned by the PRIMARY group of the user |
| 51 | # this will not work if the user belongs in secondary groups |
| 52 | eval |
| 53 | else |
| 54 | if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then |
| 55 | echo "Cannot find $PRGDIR/$EXECUTABLE" |
| 56 | echo "The file is absent or does not have execute permission" |
| 57 | echo "This file is needed to run this program" |
| 58 | exit 1 |
| 59 | fi |
| 60 | fi |
| 61 | |
| 62 | exec "$PRGDIR"/"$EXECUTABLE" stop "$@" |