Skip to content

Commit

Permalink
check for admin server on specific port instead of using sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoborges committed Feb 11, 2016
1 parent d965c47 commit b2039c3
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 11 deletions.
Expand Up @@ -5,12 +5,25 @@
CONFIG_JVM_ARGS="${CONFIG_JVM_ARGS} -Dweblogic.security.SSL.ignoreHostnameVerification=true"
WLST="wlst.sh -skipWLSModuleScanning"

# If log.nm does not exists, container is starting for 1st time
# So it should start NM and also associate with AdminServer
# Otherwise, only start NM (container restarted)
if [ ! -f log.nm ]; then
ADD_MACHINE=1
fi

# Start Node Manager
nohup startNodeManager.sh > log.nm &
sleep 5
echo "Starting NodeManager in background..."
nohup startNodeManager.sh > log.nm 2>&1 &
echo "NodeManager started."

# Wait for AdminServer to become available for any subsequent operation
./waitForAdminServer.sh

# Add a Machine to the AdminServer
$WLST /u01/oracle/add-machine.py
# Add a Machine to the AdminServer only if 1st execution
if [ $ADD_MACHINE -eq 1 ]; then
$WLST /u01/oracle/add-machine.py
fi

# print log
tail -f log.nm
Expand Up @@ -5,15 +5,26 @@
CONFIG_JVM_ARGS="${CONFIG_JVM_ARGS} -Dweblogic.security.SSL.ignoreHostnameVerification=true"
WLST="wlst.sh -skipWLSModuleScanning"

# If log.nm does not exists, container is starting for 1st time
# So it should start NM and also associate with AdminServer, as well Managed Server
# Otherwise, only start NM (container is being restarted)
if [ ! -f log.nm ]; then
ADD_SERVER=1
fi

# Start Node Manager
nohup startNodeManager.sh > log.nm &
sleep $DELAY_NM_REGISTRATION
echo "Starting NodeManager in background..."
nohup startNodeManager.sh > log.nm 2>&1 &
echo "NodeManager started."

# Add a Machine to the AdminServer
$WLST /u01/oracle/add-machine.py
# Wait for AdminServer to become available for any subsequent operation
./waitForAdminServer.sh

# Wait and add a new Managed Server
$WLST /u01/oracle/add-server.py
# Add this 'Machine' and 'ManagedServer' to the AdminServer only if 1st execution
if [ $ADD_SERVER -eq 1 ]; then
$WLST /u01/oracle/add-machine.py
$WLST /u01/oracle/add-server.py
fi

# print log
tail -f log.nm
tail -f log.nm /u01/oracle/user_projects/domains/$DOMAIN_NAME/servers/*/logs/*.out
@@ -0,0 +1,16 @@
#!/bin/bash
#
# This script will wait until Admin Server is available.
# There is no timeout!
#
echo "Waiting for WebLogic Admin Server on $ADMIN_HOST:$ADMIN_PORT to become available..."
while :
do
(echo > /dev/tcp/$ADMIN_HOST/$ADMIN_PORT) >/dev/null 2>&1
available=$?
if [[ $available -eq 0 ]]; then
echo "WebLogic Admin Server is now available. Proceeding..."
break
fi
sleep 1
done

0 comments on commit b2039c3

Please sign in to comment.