#! /Bin/sh # # $ ID: jboss_init_redhat.sh 46554 10: 29: 13z Dimitris $ # # JBoss control script # # To use this script run it as root-it willSwitchTo the specified user # # 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. # # Either modify this script for your requirements or just ensure that # The following variables are set correctly before calling the script.# Change to the installation directory of your local JBoss Jboss_home =$ {jboss_home:-"/home/JBoss/jboss-4.0.5.GA "} # Change to your new JBoss user Jboss_user =$ {jboss_user:-"JBoss "} # Change to localJavaPath Javapth =$ {javapth:-"/home/JBoss/jdk1.5.0 _ 14/bin "} # StartedConfigurationParameter, which has three values: 'decimal', 'default', and 'all'. All is configured in cluster mode. Jboss_conf =$ {jboss_conf:-"default "} # Bind all network adapters. If you bind one, write yourIP address. It is used only when jboss4.2.0 + is used externally. # Jboss_host =$ {jboss_host:-"0.0.0.0 "} # The script is disabled by default. It seems that it is not easy to use and I will not use it. # Jbosp_=$ {jbosp_:-"$ jboss_home/bin/shutdown. jar: $ jboss_home/client/jnet. Jar "} # Disable the script when binding an IP address to an external service in jboss4.2.0 + # Jbosp_=$ {jbosp_:-"$ jboss_home/bin/shutdown. Sh-S $ jboss_host "} # JBoss close the script Jbosp_=$ {jbosp_:-"$ jboss_home/bin/shutdown. Sh-s "} # This is started when jboss4.2.0 + is used for external services. # Jbosssh =$ {jbosssh:-"$ jboss_home/bin/run. Sh-C $ jboss_conf-B $ jboss_host "} # JBoss startup Jbosssh =$ {jbosssh:-"$ jboss_home/bin/run. Sh-C $ jboss_conf "} If ["$ jboss_user" = "runasis"]; then Subit = "" Else Subit = "Su-$ jboss_user-c" Fi If [-n "$ jboss_console"-! -D "$ jboss_console"]; then # Ensure the file exists Touch $ jboss_console If [! -Z "$ subit"]; then Chown $ jboss_user $ jboss_console Fi Fi If [-n "$ jboss_console"-! -F "$ jboss_console"]; then Echo "Warning: location for saving console log invalid: $ jboss_console" # Self-start log # Echo "Warning: ignoring it and using/dev/null" Echo "Warning: ignoring it and using $ jboss_home/jbossautostart. log" # Self-start log # Jboss_console = "/dev/null" Jboss_console =$ {jboss_console:-"$ jboss_home/jbossautostart. log "} Fi # Self-start log # Jboss_console =$ {jboss_console:-"/dev/null "} Jboss_console =$ {jboss_console:-"$ jboss_home/jbossautostart. log "} Jboss_cmd_start = "CD $ jboss_home/bin; $ jbosssh" # This is the default one. It is not as easy as above. # Jboss_cmd_stop =$ {jboss_cmd_stop:-"Java-classpath $ jbosin org. JBoss. Shutdown -- shutdown-s "} # My own method of disabling Jboss_cmd_stop =$ {jboss_cmd_stop:-"CD $ jboss_home/bin; $ jbopd "} 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 # This is the default console to print the startup script command. If it is uncomfortable, it will be disabled. # Echo jboss_cmd_start = $ jboss_cmd_start Case "$1" in Start) Echo "JBoss start .........." CD $ jboss_home/bin If [-z "$ subit"]; then Eval $ jboss_cmd_start >$ {jboss_console} 2> & 1 & Else $ Subit "$ jboss_cmd_start >$ {jboss_console} 2> & 1 &" Fi ;; Stop) Echo "JBoss stop ........." If [-z "$ subit"]; then $ Jboss_assist_stop Else $ Subit "$ jboss_assist_stop" Fi ;; Restart) Echo "JBoss restart ........" $0 stop Sleep 60 $0 start ;; *) Echo "Usage: $0 (START | stop | restart | help )" Esac |