LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 901|回复: 4

shell脚本疑问

[复制链接]
发表于 2006-3-29 11:32:03 | 显示全部楼层 |阅读模式
这是一段关闭weblogic 的脚本.(./stopweblogic.sh username password)

#!/bin/sh

# WARNING: This file is created by the Configuration Wizard.
# Any changes to this script may be lost when adding extensions to this configuration.

# *************************************************************************
# This script is used to stop WebLogic Server created by Config Wizard
# Usage: stopWebLogic [username] [password] [server-name] [admin-url]
# The default value of server-name is shenbao
# The default value of admin-url is t3://localhost:7001
# For additional information, refer to the WebLogic Server Administration
# Console Online Help(http://e-docs.bea.com/wls/docs81/ConsoleHelp/startstop.html)
# *************************************************************************

if [ "$1" != "" ] ; then
        UIDPWD="-username $1"
        shift
fi

if [ "$1" != "" ] ; then
        UIDPWD="${UIDPWD} -password $1"
        shift
fi

if [ "true" = "" ] ; then
        if [ "${UIDPWD}" = "" ] ; then     #"true"是什么意思?
                echo "ERROR: Because your domain was created as a production mode domain. "
                echo "You MUST include a username parameter that can be used to shutdown Weblogic Server"
                read _val
                exit
        fi
fi

# set server name

SERVER_NAME="shenbao"

if [ "$1" != "" ] ; then
        SERVER_NAME="$1"
        shift
fi

if [ "${SERVER_NAME}" = "" ] ; then
        echo "ERROR: Missing Server Name. "
        echo "Usage: stopWebLogic.cmd(sh) [username] [password] [server-name] [admin-url]"
        read _val
        exit
fi

# set ADMIN_URL

if [ "$1" != "" ] ; then
        ADMIN_URL="$1"
        shift
else
        if [ "${ADMIN_URL}" = "" ] ; then
                ADMIN_URL="t3://localhost:7001"
        fi
fi

# Call commEnv here.

. /home/weblogic/bea/weblogic81/common/bin/commEnv.sh

echo "Stopping Weblogic Server..."

${JAVA_HOME}/bin/java -cp ${WEBLOGIC_CLASSPATH} weblogic.Admin FORCESHUTDOWN -url ${ADMIN_URL} ${UIDPWD} ${SERVER_NAME}  2>&1

echo "Done"

我的问题是下面2个条件表达,有什么区别,是不是前者可以不用验证密码?

if [ "true" = "" ] ; then
        if [ "${UIDPWD}" = "" ] ;   [color="Red"]  

if [ "true" = "true" ] ; then
        if [ "${UIDPWD}" = "" ] ;

谢谢
发表于 2006-3-29 14:57:55 | 显示全部楼层
Looks pretty weird testing statment to me.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-30 16:34:08 | 显示全部楼层
我已把整段脚本贴上来了,请帮忙我看一下

因为现在结束程序一定要在./stopWeblogic.sh 后加上用户和密码
我就是想知道更改上述脚本不用对用户和密码进行认证,结束服务。

谢谢
回复 支持 反对

使用道具 举报

发表于 2006-3-30 23:36:29 | 显示全部楼层
你的 weblogic 版本是多少?也许去 bea 官方论坛 问问比较直接。。

反正你是需要用户和密码才能 shutdown 那些 domains 的,这些不是bash需要的,是 wls 需要的。

用 WebLogic 是学 EJB 还是 JSP/Servlet? :)。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-4-2 23:31:35 | 显示全部楼层
我也是刚接触,准备学Jsp,websphere也准备看看

应该可以的,感觉是true=true改一下
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表