gpt4 book ai didi

linux - Jboss 作为 Linux 中的服务

转载 作者:太空宇宙 更新时间:2023-11-04 10:57:30 25 4
gpt4 key购买 nike

我的 Linux 机器上有一个 Jboss 作为服务。我从 sudo sh/etc/init.d/jbossas7 start 开始。脚本是:

#!/bin/bash### BEGIN INIT INFO  
#chkconfig: 345 90 10
#description: JBOSS 7
#processname: jbossas7
#Provides: jbossas7
#Required-Start: $local_fs $remote_fs $network $syslog
#Required-Stop: $local_fs $remote_fs $network $syslog
#Default-Start: 2 3 4 5
#Default-Stop: 0 1 6
#Short-Description: Start/Stop JBoss AS 7
### END INIT INFO

## Include some script files in order to set and export environmental variables
## as well as add the appropriate executables to $PATH.
[ -r /etc/profile.d/java.sh ] && . /etc/profile.d/java.sh
[ -r /etc/profile.d/jboss.sh ] && . /etc/profile.d/jboss.sh

JBOSS_HOME=/home/users/jboss/jboss-eap-6.2

AS7_OPTS="$AS7_OPTS -Dorg.apache.tomcat.util.http.ServerCookie.ALLOW_HTTP_SEPARATORS_IN_V0=true" ## See AS7-1625
AS7_OPTS="$AS7_OPTS -Djboss.bind.address.management=0.0.0.0"
AS7_OPTS="$AS7_OPTS -Djboss.bind.address=0.0.0.0"

case "$1" in
start)
echo "Starting JBoss AS 7..."
#sudo -u jboss sh ${JBOSS_HOME}/bin/standalone.sh $AS7_OPTS ## If running as user "jboss"
#start-stop-daemon --start --quiet --background --chuid jboss --exec ${JBOSS_HOME}/bin/standalone.sh $AS7_OPTS ## Ubuntu
${JBOSS_HOME}/bin/standalone.sh $AS7_OPTS &
;;
stop)
echo "Stopping JBoss AS 7..."
#sudo -u jboss sh ${JBOSS_HOME}/bin/jboss-admin.sh --connect command=:shutdown ## If running as user "jboss"
#start-stop-daemon --start --quiet --background --chuid jboss --exec ${JBOSS_HOME}/bin/jboss-admin.sh -- --connect command=:shutdown ## Ubuntu
${JBOSS_HOME}/bin/jboss-cli.sh --connect command=:shutdown
;;

*)
echo "Usage: /etc/init.d/jbossas7 {start|stop}"; exit 1;
;;
esac

exit 0

我还执行了下一个命令:

sudo /sbin/chkconfig --add jbossas7
sudo /sbin/chkconfig jbossas7
sudo /sbin/chkconfig --level 123456 jbossas7 on

但是在重启机器后 JBoss 不工作了。我想让我的服务器自动启动。怎么了?

最佳答案

我已经在 serverfault 上回答了这个问题

第一行有错别字

#!/bin/bash### BEGIN INIT INFO  
#chkconfig: 345 90 10

应该是

#!/bin/bash
### BEGIN INIT INFO
#chkconfig: 345 90 10

关于linux - Jboss 作为 Linux 中的服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28301334/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com