禁用websphere app autostart命令行或管理脚本

时间:2018-04-16 10:24:55

标签: websphere autostart

我正在寻找一个管理命令或脚本来禁用WAS托管的应用程序的自动启动。

我通过以下菜单中的网络界面找到了: 申请 - >申请类型 - > Websphere企业应用程序 - >点击App - >详细信息属性:“目标特定应用程序状态” - >选择群集并单击“禁用自动启动”。

但无法找到与此操作对应的命令行。

你能帮助我吗?

提前谢谢你,

1 个答案:

答案 0 :(得分:1)

您可以使用" wsadminlib.py"脚本库很容易做到这一点,它包含一个带签名的setDeploymentAutoStart函数:

这是签名和doc:

def setDeploymentAutoStart(deploymentname, enabled, deploymenttargetname=None):
    """Sets an application to start automatically, when the server starts.
    Specify enabled as a lowercase string, 'true' or 'false'.
    For example, setDeploymentAutoStart('commsvc', 'false')
    Returns the number of deployments which were found and set successfully.
    Raises exception if application is not found.
    You may optionally specify an explicit deployment target name, such as a server or cluster name.
    For example, setDeploymentAutoStart('commsvc', 'true',  deploymenttargetname='cluster1')
                 setDeploymentAutoStart('commsvc', 'false', deploymenttargetname='server1')
    If the deployment target name is not specified, autostart is set on all instances of the deployment.
    Ultimately, this method changes the 'enable' value in a deployment.xml file.  For example,
    <targetMappings xmi:id="DeploymentTargetMapping_1262640302437" enable="true" target="ClusteredTarget_1262640302439"/>
    """

使用wsadminlib.py就像从github下载它一样简单,启动wsadmin,然后运行execfile /path/to/wsadminlib.py

然后你只需要整理你想要的参数并调用上面的函数。