linux 中tomcat启动脚本,请解释。

#!/bin/sh#LicensedtotheApacheSoftwareFoundation(ASF)underoneormore#contributorlicense... #!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# -----------------------------------------------------------------------------# Start Script for the CATALINA Server
#
# $Id: startup.sh 1130937 2011-06-03 08:27:13Z markt $
# -----------------------------------------------------------------------------

# Better OS/400 detection: see Bugzilla 31132os400=false
darwin=false
case "`uname`" in
CYGWIN*) cygwin=true;;
OS400*) os400=true;;
Darwin*) darwin=true;;
esac

# resolve links - $0 may be a softlinkPRG="$0"
while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done

PRGDIR=`dirname "$PRG"`
EXECUTABLE=catalina.sh

# Check that target executable existsif $os400; then
# -x will Only work on the os400 if the files are:
# 1. owned by the user
# 2. owned by the PRIMARY group of the user
# this will not work if the user belongs in secondary groups
eval
else
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
echo "Cannot find $PRGDIR/$EXECUTABLE"
echo "The file is absent or does not have execute permission"
echo "This file is needed to run this program"
exit 1
fi
fi

exec "$PRGDIR"/"$EXECUTABLE" start "$@"

请高手说明一下每行的作用。谢谢。
展开
 我来答
匿名用户
推荐于2017-11-25
展开全部
#!/bin/sh ---- 说明本文件是脚本

darwin=false
case "`uname`" in
CYGWIN*) cygwin=true;;
OS400*) os400=true;;
Darwin*) darwin=true;;
esac
----------------------------这几行,判断操作系统类别

while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
-------------------------------------------判断本脚本是否软链接

if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
echo "Cannot find $PRGDIR/$EXECUTABLE"
echo "The file is absent or does not have execute permission"
echo "This file is needed to run this program"
exit 1
fi
------------------------------判断本脚本是否能“执行”,如果不能,退出、提示

exec "$PRGDIR"/"$EXECUTABLE" start "$@" ------运行tomcat,后面的 $@是所有命令行参数
快又稳
2024-10-28 广告
Apache基于域名的虚拟主机配置主要涉及到在Apache配置文件中为不同域名指定不同的网站目录和日志路径。配置时,需确保域名已正确指向服务器的IP地址。在Apache的`httpd-vhosts.conf`或类似配置文件中,为每个域名创建... 点击进入详情页
本回答由快又稳提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式