隨筆-200  評論-148  文章-15  trackbacks-0

          #!/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 無聲 閱讀(2181) 評論(0)  編輯  收藏 所屬分類: 職場生活
          道可道非常道,名可名非常名
          <2006年9月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          1234567

          常用鏈接

          留言簿(5)

          我參與的團隊

          隨筆分類(174)

          隨筆檔案(200)

          文章分類(20)

          文章檔案(15)

          收藏夾

          開源網站

          朋友博客

          最新隨筆

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 泊头市| 乳源| 米林县| 荣昌县| 庆城县| 咸阳市| 阿坝| 宜良县| 三门峡市| 朝阳区| 尚志市| 江川县| 平顺县| 东明县| 旬邑县| 马龙县| 湟中县| 上杭县| 郎溪县| 齐河县| 从化市| 安阳县| 阳新县| 莒南县| 四平市| 津南区| 华安县| 福清市| 专栏| 吉隆县| 项城市| 温宿县| 天峨县| 樟树市| 扎兰屯市| 建湖县| 湾仔区| 广昌县| 林芝县| 收藏| 海伦市|