I have to write a script to run JBoss and also verify and inform JBoss has just started in system startup. Below code is to related to verifying part. Please correct logical and syntax mistakes I have done.
Log record I am greping:
2017-10-27 12:04:13,933 INFO [org.jboss.bootstrap.microcontainer.ServerImpl] (main) JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221053)] Started in 1m:1s:804ms
!/bin/bash
maxLoops=30 numLines=200 timeToSleep=3 success=0 Server_Log=$(/path_for_log/server.log)
for (( try=0; try < maxLoops; ++try ));
do
atail=`tail -n $numLines $Server_Log | grep "Started" | awk {'print $12'}`
if [[ $atail == "Started" ]]
then
success=1
break
fi
sleep $timeToSleep
done
if (( success ));
then
echo "Jboss started successfully"
else
echo "successful starting of Jboss is not ensured"
fi
Please find the error below that I am getting while executing the script as root:
$ ./verify_jboss.sh:
line 3: /log_path/server.log: Permission denied