Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-79

Scripts for starting JBoss as service report success when they fail

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.3.0.GA
    • 6.2.0.GA
    • Scripts
    • None
    • Hide

      run the script when the system is not configured properly so that it fails to launch. It will say [ OK ] instead of [FAILED]

      Show
      run the script when the system is not configured properly so that it fails to launch. It will say [ OK ] instead of [FAILED]

      The supplied scripts

      {JBOSS_EAP_HOME}

      /bin/init.d/jboss-as-standalone.sh and jboss-as-domain.sh report [ OK ] even when they fail. There are two problems, one readily apparent from the code and the other a bit hidden. Line numbers shown below from jboss-as-domain.sh

      103 until [ $count -gt $STARTUP_WAIT ]
      104 do
      105 grep 'JBoss AS.*started in' $JBOSS_CONSOLE_LOG > /dev/null
      106 if [ $? -eq 0 ] ; then
      107 launched=true
      108 break
      109 fi
      110 sleep 1
      111 let count=$count+1;
      112 done
      113
      114 success
      115 echo
      116 return 0

      clearly, it is reporting success even if it fails. The launched variable is never inspected. However, I found that there is a second problem, in my environment anyway. If I look at the launched variable before deciding how to report, it still doesn't work, probably because of how the shell is interpreting true and false.

      This code works:

      until [ $count -gt $STARTUP_WAIT ]
      do
      grep 'JBoss AS.*started in' $JBOSS_CONSOLE_LOG > /dev/null
      if [ $? -eq 0 ] ; then
      launched=1
      break
      fi
      sleep 1
      let count=$count+1;
      done
      if [ "$launched" -eq "1" ]
      then
      success
      echo
      return 0
      else
      failure
      echo
      return 99
      fi

              tomazcerar Tomaž Cerar (Inactive)
              stevecoh4 Steve Cohen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: