startServer 命令
startServer 命令读取所指定服务器进程的配置文件并启动该服务器进程。
- 启动应用程序服务器。
- 开始一个非军事区Secure Proxy服务器IBM® WebSphere® Application Server。
- 启动管理代理程序。
- 启动作业管理器。
如果您在 Windows 操作系统上运行该产品,并且服务器作为 Windows 操作系统服务运行,则startServer命令将启动服务器和相关的 Windows 服务。
您不必将用户名和密码与 startServer 命令配合使用,因为此命令虽然会启动服务器进程,但不会调用 MBean 方法。
- 发出 startServer -script 命令将会创建包含静态值的脚本。 从控制台更改 JVM 参数后,需要生成一个新的脚本以包含这些更改后的 JVM 参数。
- 运行 startServer -script 时,该命令将会生成一个新的脚本,此脚本包含该命令运行时的所有参数值。 如果您更改这些参数的值(或者添加新的参数),那么已生成的脚本不会包含这些新的参数值。 这些新值将以静态方式传递到新生成的脚本,因此,在创建此脚本之后进行的任何更改都需要运行新的 startServer -script,以生成包含这些更新后的值的新脚本。
- 如果更改 Java 虚拟机 Classpath 设置的值,则此新值将覆盖启动命令中 Classpath 参数的值,该值默认设置在您发出startServer-script 命令。
- 如果在“环境条目”页面上添加新的环境条目或更改现有条目的设置,那么新值和已更改值作为参数出现在您发出 startServer -script 命令时生成的脚本中。
- 如果添加的某个环境条目称为 PATH,那么为此条目指定的值会覆盖为
PATH 变量指定的值,缺省情况下,PATH 变量在 setUpCmdLine 文件中设置为 WAS_PATH。 如果
PATH 变量的值被覆盖,那么以下消息会被发送至记录了错误消息的文件:
WSVR0009E: Error occured during startup. com.ibm.ws.exception.RuntimeError: java.lang.NoClassDefFoundError: com/ibm/ws/process/Win32ProcessGlue
要了解有关从何处运行此命令的更多信息,请参阅使用命令行工具这一主题。
语法
startServer server_name [options]在哪里服务器名称是应用程序服务器的名称或非军事区Secure Proxy服务器IBM WebSphere Application Server您想要开始的。
此参数是必需的。
此自变量是可选的。 如果未指定此参数,那么会根据概要文件名来分配服务器。 如果您使用名为default, <server> 参数设置为server1。 如果配置文件名称不是default中,<server> 参数设置为配置文件名称。
startServer <adminagent_name>其中 adminagent_name 是要启动的管理代理程序的名称。
startServer <job_manager>其中 job_manager 是要启动的作业管理器的名称。
参数
下列选项可用于 startServer 命令:
- -?
- 显示用法说明。
-curlib <product_library>
指定要用于底层“提交作业”(SBMJOB) CL 命令的当前库。
-cpyenvvar
告诉startServer命令设置当前为服务器进程定义的环境变量。 缺省情况是不设置当前定义的环境变量。
- -help
- 显示用法说明。
-inllibl <library_list>
指定要用于底层“提交作业”(SBMJOB) CL 命令的初始库列表。
-inlaspgrp <ASP_group>
指定底层“提交作业”(SBMJOB) CL 命令的初始 ASP 组。
-J <java_option>
指定传递给 Java 解释器的选项。
-jobd <product_library/job_description>
指定底层“提交作业”(SBMJOB) CL 命令的作业描述。
-jobq <product_library/job_queue>
指定底层“提交作业”(SBMJOB) CL 命令的作业队列。
-logfile <fileName>
指定写入跟踪信息的日志文件的位置。 缺省情况下,日志文件名为 startServer.log,并且是在 logs 目录中创建的。
-nowait
告诉startServer命令不等待启动的服务器进程初始化成功。
-outq <product_library/output_queue>
指定底层“提交作业”(SBMJOB) CL 命令的输出队列。
- -profileName
- 在多概要文件安装中定义服务器进程的概要文件。 在单概要文件环境中运行不需要 -profileName 选项。 此选项的缺省值为缺省概要文件。
-quiet
抑制进度信息startServer命令以正常模式打印。
-replacelog
替换日志文件而不是附加到当前日志。
- -recovery
- 指定服务器将以恢复方式启动,执行事务恢复,然后关闭。 当服务器处于恢复方式时将不接受任何新事务。 当您再次启动该服务器时,由于可疑事务而不可用的资源将变为可用。
如果服务器失败,且在恢复过程中您不想接受新事务,那么请使用此选项。
对于过渡用户:如果您从产品的先前版本迁移,请确保控制器的 JCL 过程语句中包含的 ENV 参数包含 REC=N 或 REC=Y 元素。 如果 ENV 参数不包括 REC=N 或 REC=Y 元素,那么即使您指定 -recovery 选项,服务器也不会以恢复方式重新启动。如果 ENV 参数包括 REC=N 元素,那么如果您指定 -recovery,重新启动服务器时就会自动将设置更改为 REC=Y。 如果未从产品的先前版本迁移,那么 REC=N 元素将自动包括在 ENV 参数中。 以下是更新后的 PROC 语句的示例:
//BBO6ACR PROC ENV=,PARMS=' ',REC=N,Z=BBO6ACRZ当您调用startServer使用命令-recovery参数,并且恢复过程不成功,则会出现以下错误消息SystemErr.log和SystemOut.log文件:
此消息未指示恢复过程失败。 如果使用 -recovery 参数,请检查要启动的服务器的 SystemErr.log 和 SystemOut.log 文件,以确定恢复过程是否成功。CWNATV03I: Application server xxxxxx in profile xxxxxx has completed recovery. Server stopped. -sbs <product_library/subsystem_description>
指定要用于底层“提交作业”(SBMJOB) CL 命令的子系统。
-statusport <portNumber>
可选参数,允许管理员设置服务器状态回调的端口号。 该工具打开此端口并等待来自服务器的指示该服务器已启动的状态回调。 如果未设置此参数,那么将自动分配一个未使用的端口。
-script [<script fileName>] -background
生成启动脚本startServer命令而不是直接启动服务器进程。 启动脚本名称是一个可选参数。 如果不提供启动脚本名称,则默认脚本文件名为start_服务器根据作为第一个参数传递给的服务器名称startServer命令。 -background 参数是一个可选参数,用于指定当您运行它时将在后台运行生成的脚本。
- -trace
生成跟踪信息到日志文件以供调试目的。
- -timeout <seconds>
- 指定在服务器初始化超时并返回错误之前的等待时间。
-usejobd
指定切换至 Run-As 用户标识时,将“提交作业”(SBMJOB) 进程中的作业描述用于服务器。
笔记:此命令不会影响当前作业描述的 USER 字段。
使用方案
以下示例说明正确的语法。 括号中的信息是在发出前面的命令时会创建的输出描述。
startServer server1
startServer server1 -script (produces the start_server1.sh or .bat files)
startServer server1 -trace (produces the startserver.log file)
startServer adminagent
startServer.sh server1 -trace -username MyUserName -password MyUserPassword
-profileName MyProfileName (starts the server1 server using the
MyProfileName profile. The server runs under the user name MyUserName,
and produces trace files under the profile_root/logs directory)startServer jobmgr
startServer proxy1 (for the secure proxy profile)startServer server1
startServer server1 -script (produces the start_server1.sh file)
startServer server1 -trace (produces the startserver.log file)
startServer adminagent
startServer jobmgr
startServer proxy1 (for the secure proxy profile)
startServer.sh server1 -trace -username MyUserName -password MyUserPassword
-profileName MyProfileName (starts the server1 server using the
MyProfileName profile. The server runs under the user name MyUserName,
and produces trace files under the profile_root/logs directory)startServer server1 (starts the server1 server for the default profile)
startServer server1 -trace (starts the server1 server for
the default profile and produces trace files under the
profile_root/logs directory)
startServer -profileName mytest (starts server mytest
configured under profile mytest)
startServer AdminAgent01startServer JobMgr01
startServer proxy1 (default server name for the SecureProxySrv01 profile)startServer.sh server1 -trace -username MyUserName -password MyUserPassword
-profileName MyProfileName (starts the server1 server using the
MyProfileName profile. The server runs under the user name MyUserName,
and produces trace files under the profile_root/logs directory)退出码
如何捕获 startServer 和 stopServer 的返回码以确定操作是否成功? 该表显示了对于指定的启动或停止命令,服务器的返回码。
#!/bin/sh
exitCode=`./startServer.sh server1`| 服务器状态 | 返回码 |
|---|---|
| 服务器初始化失败 | -1 |
| 服务器初始化已超时 | -2 |
| 服务器正在启动 | 1 |
| 服务器正在初始化存在的应用程序 | 2 |
| 服务器初始化完成(成功) | 0 |
| 服务器停止失败 | -10 |
| 服务器停止已超时 | -11 |
| 服务器停止操作已启动 | 1000 |
| 服务器成功停止 | 0 |