Question: I am trying find out, how to start JBoss with cron job at a particular time. 

What I am doing at the moment is setup a cron, then inside JBoss startinstance script I put sleep 700 seconds until jboss starts.

Is there a better way to actually know when JBoss has successfully started and then continue with the flow after, instead of sleeping for 700 seconds? Did anyone do something similar?

I have got something like this, and I do not think this is the right solution :

```
#!/bin/ksh
#This script accepts one parameter URL which should to tracked

usage() {
    msg=${1}
    echo "ERROR: "
    exit 1
}

args_no=$#

if [[ ${args_no} -ne 1 ]]; then
    usage
fi

URL_to_check=${1}

jboss_status=1

while [[ ${jboss_status} -ne 0 ]]; do
    wget ${URL_to_check} > /dev/null
    jboss_status=$?
    sleep 10
done

exit 0  

```

Answer: 
You could poll your log file and check for the line

```
ServerImpl.info: JBoss.*Started in

```

and sleep in between the polls. For instance:

```
LOG_FILE=/path/to/jboss.log
start_info=''

while [[ ! -n "${start_info}" ]]; do
    start_info=`grep "ServerImpl.info: JBoss.*Started in" $LOG_FILE`
    sleep 10
done

```
Why is JBoss startup a scheduled job? Shouldn't JBoss just be started and run for a very long time?

The best way to start JBoss is to start the server once, without a sleep, and let it run for months or years. That means that the operating system it's deployed on is stable and your application doesn't leak memory. You should only bring JBoss down for OS patches and application updates.

Anything else and you've got a problem that you should dig into to resolve.