Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10708067
  • 博文数量: 2905
  • 博客积分: 20098
  • 博客等级: 上将
  • 技术积分: 36298
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-23 05:00
文章存档

2012年(1)

2011年(3)

2009年(2901)

分类: LINUX

2009-03-23 11:26:53

安装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


阅读(961) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~