Configure JBoss Auto start __linux under Linux

Source: Internet
Author: User
Tags chmod jboss
Configure JBoss to start automatically under Linux

(JBoss V4.0)

#为root用户的命令提示符 $ for the JBoss user's command prompt <?xml:namespace prefix = o ns = "Urn:schemas-microsoft-com:office:office"/>

Ø install j2sdk to/usr/local/j2sdk<?xml:namespace prefix = st1 ns = "Urn:schemas-microsoft-com:office:smarttags"/>1 .4.2, edit/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

Ø install JBoss4.0 to/usr/local/jboss4x, edit/etc/profile

#/etc/profile

jboss_home=/usr/local/jboss4x

Path= $PATH: $JBOSS _home/bin

Export JBOSS _home PATH

Ø copy JBoss4 with boot file to/ETC/INIT.D

# CP $JBOSS _home/bin/jboss_init_redhat.sh/etc/init.d/

Ø Set Start step

# 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

A s80jboss_init_redhat.sh connection file is created under/ETC/RC3.D and/ETC/RC5.D, and then the execution permissions are assigned (in order to simply use 777 of the permissions)

# 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

Ø Edit/etc/init.d/jboss_init_redhat.sh file (Note: Red for modified part)

# 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'll 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 is changed in the script itself.

# Bojan

#

# either amend this script for your requirements

# or just ensure that 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 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 would be doing with the console log

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

#define the user under which JBoss would 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 "$" 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)

$ stop

$ start

;;

*)

echo "Usage: $ (START|STOP|RESTART|HELP)"

Esac

Ø Add JBoss Users and assign groups

# Useradd JBoss

# usermod-g Jboss,root JBoss

Ø configuration complete, restart Linux server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.