jboos linux启动脚本,linux下jboss自启动设置

#!/bin/sh

#

# JBoss Control Script

#

# chkconfig: 3 80 20

# description: JBoss EJB Container

#

# To use this script

# run it as root - it will switch to the specified user

# It loses all console output - use the log.

#

# Here is a little (and extremely primitive)

# startup/shutdown script for RedHat systems. It assumes

# that JBoss lives in /usr/local/jboss, it's run by user

# 'jboss' and JDK binaries are in /usr/local/jdk/bin. All

# this can be changed in the script itself.

# Bojan

#

# Either amend this script for your requirements

# or just ensure that the following variables are set correctly

# before calling the script

# [ #420297 ] JBoss startup/shutdown for RedHat

#define where jboss is - this is the directory containing directories log, bin, conf etc

JBOSS_HOME=${JBOSS_HOME:-"/opt/jboss"}

#make java is on your path

JAVAPTH=${JAVAPTH:-"/usr/local/j2sdk1.4.2_06/bin"}

#define the classpath for the shutdown class

JBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/shutdown.sh -S"}

#define the script to use to start jboss

JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c default"}

if [ -n "$JBOSS_CONSOLE" -a ! -d "$JBOSS_CONSOLE" ]; then

# ensure the file exists

touch $JBOSS_CONSOLE

fi

if [ -n "$JBOSS_CONSOLE" -a ! -f "$JBOSS_CONSOLE" ]; then

echo "WARNING: location for saving console log invalid: $JBOSS_CONSOLE"

echo "WARNING: ignoring it and using /dev/null"

JBOSS_CONSOLE="/dev/null"

fi

#define what will be done with the console log

JBOSS_CONSOLE=${JBOSS_CONSOLE:-"/dev/null"}

#define the user under which jboss will run, or use RUNASIS to run as the current user

JBOSSUS=${JBOSSUS:-"root"}

CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"

CMD_STOP="cd $JBOSS_HOME/bin; $JBOSSCP"

if [ "$JBOSSUS" = "RUNASIS" ]; then

SUBIT=""

else

SUBIT="su - $JBOSSUS -c "

fi

if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then

export PATH=$PATH:$JAVAPTH

fi

if [ ! -d "$JBOSS_HOME" ]; then

echo JBOSS_HOME does not exist as a valid directory : $JBOSS_HOME

exit 1

fi

case "$1" in

start)

echo CMD_START = $CMD_START

cd $JBOSS_HOME/bin

if [ -z "$SUBIT" ]; then

eval $CMD_START >${JBOSS_CONSOLE} 2>&1 &

else

$SUBIT "$CMD_START >${JBOSS_CONSOLE} 2>&1 &"

fi

;;

stop)

echo CMD_STOP = $CMD_STOP

if [ -z "$SUBIT" ]; then

eval $CMD_STOP >${JBOSS_CONSOLE} 2>&1 &

else

$SUBIT "$CMD_STOP  >${JBOSS_CONSOLE} 2>&1 &"

fi

;;

restart)

$0 stop

$0 start

;;

*)

echo "usage: $0 (start|stop|restart|help)"

esac

将以上代码保存名为jboss的文件放到/etc/init.d目录下

linux操作步骤

修改jboss文件中的jdk路径和jboss路径

修改启动jboss的用户

将jboss文件拷贝到/etc/init.d目录下面

chkconfig --add jboss

chkconfig --level 3 jboss on

chkconfig --level 5 jboss on

重新启动计算机即可。

posted on 2006-09-27 16:16 无声 阅读(2093) 评论(0)  编辑  收藏 所属分类: 职场生活

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值