Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > .NET > C#.NET > Linux下配置JBoss自动启动
【标  题】:Linux下配置JBoss自动启动
【关键字】:linux,jboss
【来  源】:http://blog.csdn.net/kongxx/

Linux下配置JBoss自动启动

Your Ad Here  

Linux下配置JBoss自动启动

JBoss V4.0

#root用户的命令提示符 $jboss用户的命令提示符

Ø         安装J2SDK/usr/local/j2sdk1.4.2,编辑/etc/profile

# /etc/profile

JAVA_HOME=/usr/local/j2sdk

PATH=$PATH:$JAVA_HOME/bin

CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar

 

export JAVA_HOME PATH CLASSPATH

Ø         安装JBoss4.0/usr/local/jboss4x,编辑/etc/profile

# /etc/profile

JBOSS_HOME=/usr/local/jboss4x

PATH=$PATH:$JBOSS_HOME/bin

 

export JBOSS _HOME PATH

Ø         复制JBoss4自带的启动文件到/etc/init.d

# cp $JBOSS_HOME/bin/jboss_init_redhat.sh  /etc/init.d/

Ø         设置启动脚步

ln –s /etc/init.d/jboss_init_redhat.sh /etc/rc3.d/K20jboss_init_redhat

ln –s /etc/init.d/jboss_init_redhat.sh /etc/rc3.d/S80jboss_init_redhat

ln –s /etc/init.d/jboss_init_redhat.sh /etc/rc5.d/K20jboss_init_redhat

ln –s /etc/init.d/jboss_init_redhat.sh /etc/rc5.d/S80jboss_init_redhat

此时会在/etc/rc3.d/etc/rc5.d下创建一个S80jboss_init_redhat.sh的连接文件,然后分配执行权限(为了简单使用了777的权限)

# chmod –f 777 /etc/init.d/jboss_init_redhat.sh

# chmod –f 777 /etc/rc3.d/S80jboss_init_redhat.sh

# chmod –Rf 777 $JBOSS_HOME

Ø         编辑/etc/init.d/jboss_init_redhat.sh文件(注:红色为修改部分)

vi /etc/init.d/jboss_init_redhat.sh

#!/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:-"/usr/local/jboss4x"}

 

#make java is on your path

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

 

#define the classpath for the shutdown class

JBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/shutdown.jar:$JBOSS_HOME/client/jnet.jar"}

 

#define the script to use to start jboss

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

 

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:-"jboss"}

 

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

CMD_STOP="java -classpath $JBOSSCP org.jboss.Shutdown --shutdown"

 

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

 

echo CMD_START = $CMD_START

 

case "$1" in

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)

    if [ -z "$SUBIT" ]; then

        $CMD_STOP

    else

        $SUBIT "$CMD_STOP"

    fi

    ;;

restart)

    $0 stop

    $0 start

    ;;

*)

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

esac

Ø         添加jboss用户并分配组

useradd jboss

usermod -G jboss,root jboss

Ø         配置完成,重新启动Linux服务器

C#串口操作:【上一篇】
判断独立点与多边形位置关系的算法:【下一篇】
【相关文章】
没有相关文章
【随机文章】
  • 英语
  • 2.2.x内核IP伪装存在安全漏洞
  • 方法的可变参数(... args)
  • 除错(Debug)--错误的种类
  • 优化hibernate性能的几点建议【转】
  • jsp学习日记
  • DHCP
  • 用ACE静态服务配置实现简单的Echo服务
  • 读<泛形编程与STL>笔记
  • Applet
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.