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