Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

Unnamed
Friday, November 30th, 2007 at 10:48:33am UTC 

  1. #!/bin/sh
  2. ### ====================================================================== ###
  3. ##                                                                          ##
  4. ##  JBoss Bootstrap Script                                                  ##
  5. ##                                                                          ##
  6. ### ====================================================================== ###
  7.  
  8. ### $Id: run.sh,v 1.9.2.5 2004/01/01 01:20:38 starksm Exp $ ###
  9.  
  10. DIRNAME=`dirname $0`
  11. PROGNAME=`basename $0`
  12. GREP="grep"
  13.  
  14. # Use the maximum available, or set MAX_FD != -1 to use that
  15. MAX_FD="maximum"
  16.  
  17. #
  18. # Helper to complain.
  19. #
  20. warn() {
  21.     echo "${PROGNAME}: $*"
  22. }
  23.  
  24. #
  25. # Helper to puke.
  26. #
  27. die() {
  28.     warn $*
  29.     exit 1
  30. }
  31.  
  32. # OS specific support (must be 'true' or 'false').
  33. cygwin=false;
  34. darwin=false;
  35. case "`uname`" in
  36.     CYGWIN*)
  37.         cygwin=true
  38.         ;;
  39.  
  40.     Darwin*)
  41.         darwin=true
  42.         ;;
  43. esac
  44.  
  45. # Read an optional running configuration file
  46. if [ "x$RUN_CONF" = "x" ]; then
  47.     RUN_CONF="$DIRNAME/run.conf"
  48. fi
  49. if [ -r $RUN_CONF ]; then
  50.     . $RUN_CONF
  51. fi
  52.  
  53. # For Cygwin, ensure paths are in UNIX format before anything is touched
  54. if $cygwin ; then
  55.     [ -n "$JBOSS_HOME" ] &&
  56.         JBOSS_HOME=`cygpath --unix "$JBOSS_HOME"`
  57.     [ -n "$JAVA_HOME" ] &&
  58.         JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  59.     [ -n "$JAVAC_JAR" ] &&
  60.         JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`
  61. fi
  62.  
  63. # Setup JBOSS_HOME
  64. if [ "x$JBOSS_HOME" = "x" ]; then
  65.     # get the full path (without any relative bits)
  66.     JBOSS_HOME=`cd $DIRNAME/..; pwd`
  67. fi
  68. export JBOSS_HOME
  69.  
  70. # Increase the maximum file descriptors if we can
  71. if [ "$cygwin" = "false" ]; then
  72.     MAX_FD_LIMIT=`ulimit -H -n`
  73.     if [ $? -eq 0 ]; then
  74.         if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
  75.             # use the system max
  76.             MAX_FD="$MAX_FD_LIMIT"
  77.         fi
  78.  
  79.         ulimit -n $MAX_FD
  80.         if [ $? -ne 0 ]; then
  81.             warn "Could not set maximum file descriptor limit: $MAX_FD"
  82.         fi
  83.     else
  84.         warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
  85.     fi
  86. fi
  87.  
  88. # Setup the JVM
  89. if [ "x$JAVA" = "x" ]; then
  90.     if [ "x$JAVA_HOME" != "x" ]; then
  91.         JAVA="$JAVA_HOME/bin/java"
  92.     else
  93.         JAVA="java"
  94.     fi
  95. fi
  96.  
  97. # Setup the classpath
  98. runjar="$JBOSS_HOME/bin/run.jar"
  99. if [ ! -f $runjar ]; then
  100.     die "Missing required file: $runjar"
  101. fi
  102. JBOSS_BOOT_CLASSPATH="$runjar"
  103.  
  104. # Include the JDK javac compiler for JSP pages. The default is for a Sun JDK
  105. # compatible distribution which JAVA_HOME points to
  106. if [ "x$JAVAC_JAR" = "x" ]; then
  107.     JAVAC_JAR="$JAVA_HOME/lib/tools.jar"
  108. fi
  109. if [ ! -f "$JAVAC_JAR" ]; then
  110.    # MacOSX does not have a seperate tools.jar
  111.    if [ "$darwin" != "true" ]; then
  112.       warn "Missing file: $JAVAC_JAR"
  113.       warn "Unexpected results may occur.  Make sure JAVA_HOME points to a JDK and not a JRE."
  114.    fi
  115. fi
  116.  
  117. if [ "x$JBOSS_CLASSPATH" = "x" ]; then
  118.     JBOSS_CLASSPATH="$JBOSS_BOOT_CLASSPATH:$JAVAC_JAR"
  119. else
  120.     JBOSS_CLASSPATH="$JBOSS_CLASSPATH:$JBOSS_BOOT_CLASSPATH:$JAVAC_JAR"
  121. fi
  122.  
  123. # If JAVA_OPTS is not set try check for Hotspot
  124. if [ "x$JAVA_OPTS" = "x" ]; then
  125.  
  126.     # Check for SUN(tm) JVM w/ HotSpot support
  127.     if [ "x$HAS_HOTSPOT" = "x" ]; then
  128.         HAS_HOTSPOT=`$JAVA -version 2>&1 | $GREP -i HotSpot`
  129.     fi
  130.  
  131.     # Enable -server if we have Hotspot, unless we can't
  132.     if [ "x$HAS_HOTSPOT" != "x" ]; then
  133.         # MacOS does not support -server flag
  134.         if [ "$darwin" != "true" ]; then
  135.             JAVA_OPTS="-server"
  136.         fi
  137.     fi
  138. fi
  139.  
  140. # Setup JBoss sepecific properties
  141. # this includes: maximum heap size (256m for prod), stack size (follows jboos tunning)
  142. # add this to use a keystore -Djavax.net.ssl.trustStore=C:\jbilling\ssl\client.keystore -Djavax.net.ssl.trustStorePassword=myPassword"
  143. JAVA_OPTS="$JAVA_OPTS -Xmx256m -Xss128k -Dprogram.name=$PROGNAME"
  144.  
  145. # For Cygwin, switch paths to Windows format before running java
  146. if $cygwin; then
  147.     JBOSS_HOME=`cygpath --path --windows "$JBOSS_HOME"`
  148.     JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  149.     JBOSS_CLASSPATH=`cygpath --path --windows "$JBOSS_CLASSPATH"`
  150. fi
  151.  
  152. # Display our environment
  153. echo "========================================================================="
  154. echo ""
  155. echo "  JBoss Bootstrap Environment"
  156. echo ""
  157. echo "  JBOSS_HOME: $JBOSS_HOME"
  158. echo ""
  159. echo "  JAVA: $JAVA"
  160. echo ""
  161. echo "  JAVA_OPTS: $JAVA_OPTS"
  162. echo ""
  163. echo "  CLASSPATH: $JBOSS_CLASSPATH"
  164. echo ""
  165. echo "========================================================================="
  166. echo ""
  167.  
  168. STATUS=10
  169. while [ $STATUS -eq 10 ]
  170. do
  171. # Execute the JVM
  172.    "$JAVA" $JAVA_OPTS \
  173.       -classpath "$JBOSS_CLASSPATH" \
  174.       org.jboss.Main "[email protected]"       
  175.    STATUS=$?
  176.    # if it doesn't work, you may want to take a look at this:
  177.    #    http://developer.java.sun.com/developer/bugParade/bugs/4465334.html
  178. done

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right