Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何通过unixshell从Websphere计算环境条目_Shell_Unix_Websphere_Websphere 8_System Variable - Fatal编程技术网

如何通过unixshell从Websphere计算环境条目

如何通过unixshell从Websphere计算环境条目,shell,unix,websphere,websphere-8,system-variable,Shell,Unix,Websphere,Websphere 8,System Variable,我在Windows机器中使用WebSphere8.5进行开发,但测试和产品是大型机上的WebSphere8.5。应用程序MyApp依赖于名为MyApp_Env的特定系统环境。基本上,这个系统环境告诉我们哪个环境正在运行(Dev、Test、Prod)。在windows中,我设置为系统环境。当此应用程序转到大型机进行用户测试时,在大型机上运行的Websphere 8.5中,将在应用程序服务器>MyServer>流程定义>服务>环境条目中设置此变量。我可以访问测试Websphere管理控制台,以便查看

我在Windows机器中使用WebSphere8.5进行开发,但测试和产品是大型机上的WebSphere8.5。应用程序MyApp依赖于名为MyApp_Env的特定系统环境。基本上,这个系统环境告诉我们哪个环境正在运行(Dev、Test、Prod)。在windows中,我设置为系统环境。当此应用程序转到大型机进行用户测试时,在大型机上运行的Websphere 8.5中,将在应用程序服务器>MyServer>流程定义>服务>环境条目中设置此变量。我可以访问测试Websphere管理控制台,以便查看它。出于某些本地原因,我没有访问Prod Websphere管理控制台的权限,我希望看到这个变量值。我可以访问ishell,所以我尝试了四种选择,(1)echo$MyApp_Env,(2)set MyApp_Env,(3)Env MyApp_Env,(4)printenv MyApp_Env。我试图通过查找简单的printenv和env之后的一个接一个来查找,但没有成功。
因此,我的问题是如何通过Unix shell发现MyApp_Env的价值?我确信变量作为WebSphereServant.Environment条目之一存在,但如何打印它呢?我猜我看不到这些变量,因为它不属于运行到终端的shell的环境变量。但是,当然,必须存在某种方式来查看其他进程(与打开的终端不同)可用的环境变量。

尽管您无法访问Prod机器的管理控制台,但我假设您能够从Unix shell在其上运行wsadmin。如果是这样,请使用文本编辑器创建一个名为myScript的脚本文件,如下所示,并使用wsadmin-f/pathToScript/myScript.jacl运行它

#get the config id of server, change Cell, Node and Server values for your env
set server1 [$AdminConfig getid /Cell:myCell/Node:myNode/Server:myServer]
# assume there is only one process definition, if there are more, you will need loop over them
set proc [$AdminConfig list JavaProcessDef $server1]
# get the list of environment entries for the process definition
set envs [lindex [$AdminConfig showAttribute $proc environment] 0]
# loop over them and display name and value of each
foreach propEntry $envs {
  puts [$AdminConfig showAttribute $propEntry name]
  puts [$AdminConfig showAttribute $propEntry value]
}

您可以使用
ps e
在某些(但不是全部)Unix系统上列出其他进程的环境变量,但它对我不起作用。我尝试了$ps e、$ps e MyApp_环境和$ps-e MyApp_环境,结果如下:用法:psÝ-Aacdefjlmr–G idlist–G grouplist–n name–o format–p proclist–s idlist–t termlist–u uidlist–然后我尝试了$ps-e,结果是TTY TIME CMD 67109234?0:00 OMVS 33555188 ttyp0002 0:00/bin/sh 67109723 ttyp0002 0:00/bin/ps