#!/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 |