In linux, jboss self-starting settings-general Linux technology-Linux programming and kernel information. The following is a detailed description. #! /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
# 'Jbos' 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
Jbosp_=$ {jbosp_:-"$ 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"-! -D "$ JBOSS_CONSOLE"]; then
# Ensure the file exists
Touch $ JBOSS_CONSOLE
Fi
If [-n "$ JBOSS_CONSOLE"-! -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 "}
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 pai_start = $ pai_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 pai_stop = $ pai_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
Save the above Code and save the file named jboss to the/etc/init. d directory.
Linux procedure
Modify the jdk path and jboss path in the jboss File
Modify the user who started jboss
Copy the jboss file to the/etc/init. d directory.
Chkconfig -- add jboss
Chkconfig -- level 3 jboss on
Chkconfig -- level 5 jboss on
Restart the computer.
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