当前位置: 首页 > 知识库问答 >
问题:

从shell脚本中停止JBoss5.x

寇丰
2023-03-14

我正在编写一些小型shell脚本实用程序,它自动部署过程。我准备了许多与在linux中关闭jboss服务器的命令相关的链接,这样我就可以从我的实用程序中关闭服务器。

阅读一些链接,这些链接将告诉如何在JBoss7或更高版本中实现这一功能,但在旧的JBoss5.x版本中则没有。其中之一是

 "$JBOSS_HOME/bin/jboss-cli.sh" --connect command=:shutdown 
sh shutdown.sh -S


[john@mymachine bin]$ sh shutdown.sh  -S
Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]]]
    at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1851)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:720)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:713)
    at javax.naming.InitialContext.lookup(InitialContext.java:411)
    at org.jboss.Shutdown.main(Shutdown.java:225)
Caused by: javax.naming.CommunicationException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]]
    at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:362)
    at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:287)
    at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1821)
    ... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]
    at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:332)
    ... 6 more
Caused by: java.net.ConnectException: Connection refused

问候

共有1个答案

杨雪松
2023-03-14

JBoss5有一个shutdown.sh,来自文档:

usage: shutdown [options] <operation>

options:
  -h, --help              Show this help message (default)
  -D<name>[=<value>]      Set a system property
  --                      Stop processing options
  -s, --server=<url>      Specify the JNDI URL of the remote server
  -n, --serverName=<url>  Specify the JMX name of the ServerImpl
  -a, --adapter=<name>    Specify JNDI name of the MBeanServerConnection to use
  -u, --user=<name>       Specify the username for authentication
  -p, --password=<name>   Specify the password for authentication

operations:
  -S, --shutdown          Shutdown the server
  -e, --exit=<code>       Force the VM to exit with a status code
  -H, --halt=<code>       Force the VM to halt with a status code
 类似资料:
  • 问题内容: 我正在写一个如下的shell脚本: 现在,我想要实现的是列出$ ACTIONS_DIR中的每个文件以执行该文件。$ ACTIONS_DIR下的每个文件都是另一个Shell脚本。 现在,这里的问题在于,使用exec之后,脚本将停止并且不会转到下一个文件。任何想法为什么会这样? 问题答案: 替换shell进程。如果只想将该命令作为子进程调用,则将其删除。

  • 问题内容: 我有一个简单的python脚本,我需要启动和停止,我需要使用start.sh和stop.sh脚本来执行此操作。 我有start.sh: 和stop.sh 我主要关注stop.sh脚本。我 认为 这是找到pid的适当方法,但我对此并不敢多说。start.sh成功启动它。当我运行stop.sh时,我无法再通过控制台找到该进程,但输出如下: 因此似乎可以正常工作,并显示“没有这样的过程”的错

  • 问题内容: 我尝试谷歌搜索答案,但没有运气。 我需要使用我的超级计算机服务器,但是要运行我的python脚本,必须通过shell脚本执行。 例如我要执行 如何做到这一点? 问题答案: 只需确保python可执行文件在PATH环境变量中,然后在脚本中添加 细节: 在文件job.sh中,放入 执行此命令以使脚本可运行: 运行 :

  • 我写了一个程序在IDLE令牌化文本文件,它开始令牌349文本文件!我怎样才能阻止它?如何停止正在运行的Python程序?

  • 问题内容: 我想从PHP脚本执行系统上存在的Bash脚本。我的系统上有两个脚本。其中一个是称为at at 的PHP脚本,另一个是称为at at 的Bash脚本。 我的client.php脚本看起来像 我的睾丸看起来像 当我在终端上执行以下操作时 我在终端上得到以下输出 但是当我在打开页面时 我得到以下输出 即使执行了chmod + x testscript,我仍然收到此错误。 我如何从浏览器中获取

  • 我为浏览器游戏制作了脚本。在这个游戏中,我站着不动,我的脚本在某些地方点击bksononechno,但我需要的是,如果我点击字母,这个脚本将自杀,而不是试图关闭浏览器及其在浏览器中的选项卡和类似的东西。 抱歉出错了。