Wednesday, January 2, 2019

Docker Cheet Sheet


Docker Cheat Sheet with examples


$ docker run -v /host/directory:/container/directory image_name command_to_run

$ docker run -d -it -v /usr/kishore/main_folder:/test_container ubuntu /bin/bash 

  
  Example
  docker run --name myjenkins -p 8080:8080 -p 50000:50000 -v /var/jenkins_home jenkins


To delete a Container?

$ docker rm container_id


To show running Containers. With -a option, it shows running and stopped Containers.

$ docker ps


To show Container information like IP adress.

$ docker inspect container_id


Pull a base image.

$ docker pull ubuntu


To create a Container.

$ docker run -d -it ubuntu /bin/bash


To stop a Container.


$ docker stop container_id

To restart a Container.


$ docker restart container_id

To Connect to a running Container.


$ docker attach container_id

To copy a file from a container to the host, you can use the command


$ docker cp containerId:/file/path/within/container /host/path/target

Copying files from host to docker container


$ docker cp foo.txt mycontainer:/foo.txt

$ docker cp mycontainer:/foo.txt foo.txt

How to mount host directory in docker container?


Friday, December 21, 2018

21-Weeks-Continuous Learning

Welcome to  our  Continuous Learning Program for 21 weeks :

As updated, this is the place where likely minded people we  are doing the best to others in  a way to share the knowledge, and real time experience in  learning, trouble shooting issues etc..  job support, charitable activities, as in the goal of "Something to society and friends ..........  "

===================================================================





Week 3/21 -  29th Dec  2018 - Learning Topic-  AWS- A to Z  -  2

Topics:

1). AWS certifications walk through  -  Everything  at  below link 
   
                   
                               All Categories of AWS Certifications - click here for more info
As per my  experience I will categorize  as below :

Cloud Practitioner - https://aws.amazon.com/certification/certified-cloud-practitioner/

1)  Solution Architect Associate
2) SysOps Administrator Associate
3)  Developer Associate

4)  Solution Architect Professional
5)  DevOps Engineer - Professional
6) 


          Tips  & Tricks - Sample Questions and answers




2). AWS certification questions

             ->  EC2
            ->   Mock/Sample questions

3) AWS - command line execution
4) AWS continuous integration/ Continuous deployment



Week 2/21 -  22nd  Dec  2018 - Learning Topic-  AWS- A to Z


Topics:

AWS A to Z covers
-Types of AWS certications
-Who has to do which certification- selection of AWS certification
- Technical demo on AWS Console
- Demo on AWS EC2 with  detailed EC2 components
-AWS S3
- Sample certification FAQs
Etc
Etc


As per Tech Survey by 2020 each AWS certified will be more demanding resources that who don’t.. in pay wise and in salary wise..   👍👍

Let’s learn..  if you already have it, please join to help others - Thank you

Please find the recording  at  -  https://www.youtube.com/watch?v=M6zeXQVuE0Q&t=17s


Week 1/21 -  15th Dec  2018 - Java-Micro services - 1



What next after this week - Java Micro Services - 2

We have completed initial session as part of continuous learning program, and  next week Yugandhar will help on demo with end to end use case with Angular, Spring, spring boot, Rest services, please utilize the best time based on all real time scenarios for coming 21 weeks - each saturday on same time -  Wishing best learning !!






Please follow us for more updates on continuous learning :

Our  Charitable organization's page :

https://www.facebook.com/sapthagiriservices/

Complete Technical Page :

https://www.facebook.com/devbigdata/


Please subscribe at our YouTube channel:

https://www.youtube.com/channel/UCQnQcKIPYmCQb-_J7iXQUxA/




Wednesday, October 24, 2018

Script to create svn account

#!/usr/bin/env bash
PASSWORDFILE=/cm/websvn/conf/passwd
TEMPFILE=/tmp/$$
ALPHA="[A-z]"
NUM="[0-9]"
ALPHANUM="[A-z|0-9]"


if [ ${#} = 0 ]
then
    echo "You need to specify at least one username."
    exit
fi

# Allow for multiple names blank-separated (as usual) or comma-separated
for U in `echo ${*} | sed -e "s;,; ;g"`
do
    # Verify username is the right syntax (lowercase it first)
    USER=`echo ${U}| tr "[A-Z]" "[a-z]" | sed -e "s;@abc.com$;;"`
    echo ${USER} | grep "^${ALPHA}${ALPHA}${NUM}${NUM}${NUM}${ALPHANUM}$" >/dev/null 2>&1
    if [ ${?} = 0 ]
    then
        grep "^${USER}[     ]*=" ${PASSWORDFILE} >/dev/null 2>&1
        if [ ${?} != 0 ]
        then
            echo "Check this person's validity at http://webphone.abc.com/cgi-bin/ladder.pl?id=${USER}"
            echo -n "Add ${USER}?> "
            read INPUT
            if [ ! -z ${INPUT} ] && [ ${INPUT} = 'y' ]
            then
                touch ${TEMPFILE} ; chmod 600 ${TEMPFILE}
                ssh ecombuild02 "< /dev/urandom  tr -cd 'A-Za-z0-9' | head -c\${1:-8} ; echo" >${TEMPFILE} 2>/dev/null
                PW=`cat ${TEMPFILE}`
                rm -f ${TEMPFILE}
                echo "${USER} = ${PW}" >> ${PASSWORDFILE}
                echo -n "Subversion (svn) account created for ${USER}. "
                sendSvnPassword.sh ${USER}
            else
                echo "Skipped ${USER}"
            fi
        else
            echo -n "${USER} already has an account, re-send password?> "
            read INPUT
            if [ ! -z ${INPUT} ] && [ ${INPUT} = 'y' ]
            then
                sendSvnPassword.sh ${USER}
            fi
        fi
    else
        echo "${USER} is not the correct syntax for a username, ignoring."
    fi
    echo
done

nginx script


#!/bin/bash
##############################################################################
#
# Init script for Nginx webservers. Located in /sites/utils/local/bin.
#
##############################################################################

#Setup our base
BASEDIR=${BASEDIR:="/sites/utils/local"}

# Source the appctl-base file for common functions and ENV variables
[ -f $BASEDIR/lib/appctl-base ] && . $BASEDIR/lib/appctl-base

ULIMIT_MAX_FILES="$ULIMIT -S -n $($ULIMIT -H -n)"
# Set the maximum number of file descriptors allowed per child process.
if [ "x$ULIMIT_MAX_FILES" != "x" ]; then
    $ULIMIT_MAX_FILES
fi

INSTANCE=$1
COMMAND=$2
F5TOOL=$F5MEMBERSTATUS
CMDPREFIX=""

# Base webserver directory
WWW_BASE=/sites/www-site

# Directory for Pre/Post Event Hook scripts
HOOKS_DIR="$WWW_BASE/hooks"

OS_TYPE=$($UNAME)
if [ "$OS_TYPE" = 'SunOS' ]; then
    LD_LIBRARY_PATH=/usr/openwin/lib:/opt/sfw/lib:/usr/lib:/usr/local/lib:/usr/ccs/lib:/usr/4lib:$LD_LIBRARY_PATH:/$BASEDIR/lib:/sites/www-site/APACHE/lib
else # Linux
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/$BASEDIR/lib:/sites/www-site/APACHE/lib
fi
export LD_LIBRARY_PATH

# Use values from global_environment if they're defined. Otherwise use these defaults.
NGINX=${NGINX:-"/sites/utils/bin/nginx"}
CTLFILE=${CTL_INPUT_BOTHELLWEBS:-"/sites/utils/local/etc/ctl/ctl.input-bothellwebs"}

# Redefined in main
DATACENTER=''

#No trailing slash on CONFBASE, its added on by CONFDIR.
CONFBASE=${CONFBASE:-"/sites/www-site/conf"}
CONFDIR=${CONFDIR:-"$CONFBASE/$($ECHO $INSTANCE | $CUT -d - -f 1)"}
CFGFILE=${CFGFILE:-"${CONFDIR}/nginx-${INSTANCE}.conf"}

LOGDIR=${LOGDIR:-"/sites/www-site/logs"}
SSLDOMAINFILE=${SSLDOMAINFILE:-"/sites/utils/local/etc/ctl/webinstance-domain.conf"}
CHIPSETFILE=${CHIPSETFILE:-"/sites/utils/local/etc/ctl/webserver-chipset.conf"}
CERTSDIR=${CERTSDIR:-"/sites/www-site/prod_ssl_certs"}
OPENSSL=${OPENSSL:-"/sites/www-site/OPENSSL/openssl-1.0.0g-niagara2-64"}

#header vars
CLUSTER=$($GETCTLATTRIBUTE $CTLFILE ${HOSTNAME} $INSTANCE cluster)

#Source the override files, ultimately used to run different
# NGINX binaries and openssl libraries per-instance if necessary.

#instance-level override, synched
[ "$OS_TYPE" = 'SunOS' ] && [ -f $CONFDIR/webctl-override.cfg ] && readAndSourceFile $CONFDIR/webctl-override.cfg

#instance-level override, not synched.
[ -f /sites/www-site/$INSTANCE-override.cfg ] && readAndSourceFile /sites/www-site/$INSTANCE-override.cfg

# Number of days to keep log files if rotating
NUMDAYS=90

#Capture the A10 control passwords
A10USER=`$GETCREDENTIALS -i 201 -u 2>/dev/null`
A10PASS=`$GETCREDENTIALS -i 201 -p -d 2>/dev/null`

##
# Usage
###
usage() {
    $ECHO "Usage: $0 instancename <status|start|stop|reload|restart|kill|startsessions|stopsessions|killsessions|clearcache|flushlogs|rotatelogs>"
    return 1
}

##
# Escape quotes in a string
##
escapeQuotes() {
    $ECHO $1 | sed 's/"/\\"/g'
}

##
# Get PIDS
###
getPids() {
    BASECFGFILE=$($BASENAME $CFGFILE)
    CMD="$PS auxwww | $EGREP \"^ *(www|root).*nginx.*$BASECFGFILE\" | $GREP -v grep"
    if [ "$ME" = "atg" ]
    then
        CMD="$CMDPREFIX \"$(escapeQuotes "$CMD")\""
    fi
    eval $CMD | awk '{print $2}'
}

setupEnv() {
        ROOTDIR=`dirname $NGINX`
        ROOTDIR="$ROOTDIR/../"

    NGINX_CMD="X_CLUSTER=$CLUSTER X_INSTANCE=$INSTANCE X_HOST=${HOSTNAME} $NGINX -p ${WWW_BASE} -c $CFGFILE"
}

##
# Start or Stop
###
startOrStopCmd() {
    command=$1
    rval=""

    setupEnv

    if [ "$command" = "start" ]; then
        # Clear log symlinks
        $CMDPREFIX "$FIND ${LOGDIR}/ -maxdepth 1 -type l -regex \".*[-_]${INSTANCE}\.log\" -delete"

        #Echo the startup logs into what would be the error log
        #TODO: Disabled as this script doesn't have perms to write to that file.
        #echoReadFiles >> $LOGDIR/error_${INSTANCE}.log
        # Pass the SSL cert value on the command line.
        # If no value was defined then SSLSTRING is empty.
        $CMDPREFIX "${NGINX_CMD}"

        if [ $? -eq 0 ]; then
            $ECHO "NGINX started."
            rval=0
        else
            $ECHO "NGINX failed to start."
            rval=1
        fi

    elif [ "$command" = "stop" ]; then
        MESSAGE=
        RVAL=

        $CMDPREFIX "${NGINX_CMD} -s stop"
        if [ $? -eq 0 ]; then
            [ -z "$MESSAGE" ] && export MESSAGE="NGINX is being stopped."
            [ -z "$RVAL" ] && export RVAL=0
        else
            export MESSAGE="NGINX failed to stop."
            export RVAL=1
        fi
        $ECHO $MESSAGE
    fi
    return $RVAL
}

##
# Kill Command
###
killCmd() {
    stat="x"
    for pass in 1 2; do
        pids=$(getPids)
        if [ "$pass" -eq 1 -a -z "$pids" ]; then
            stat="x0"
            break
        else
            for p in $pids; do
                $ECHO "killing process $p..."
                if [ "$ME" = "atg" ]; then
                    sudo su - www -c "$KILL -KILL $p"
                else
                    $KILL -KILL $p
                fi
            done
        fi

        # Sleep and do another kill because first try doesn't always work.
        $SLEEP 5
    done

    if [ "$stat" = "x" ]; then
        return 0
    else
        $ECHO "No processes to kill."
        return 1
    fi
}

##
# Output status of instance for F5 and Apache
###
fullStatus() {
    [ $# -ne 1 ] && $ECHO 1>&2 "Incorrect # of fullStatus arguments" && exit 1
    INSTANCE_NAME=$1
    F5STATUS=$(f5Status $INSTANCE_NAME)
    F5RETCODE=$?
    APACHESTATUS=$(getStatus)
    ARETCODE=$?
    $ECHO "$F5STATUS $APACHESTATUS"
    [ $F5RETCODE -ne 0 ] && return 1
    return $ARETCODE
}

##
# Get Status
###
getStatus() {
    pids=$(getPids)
    if [ -n "$pids" ]; then
        $ECHO "NGINX is running."
        return 0
    else
        $ECHO "NGINX is not running."
        return 1
    fi
}


##
# Get server chipset,used to choose which apache subversion to run
##

getChipset() {
    [ ! -e $CHIPSETFILE ] && $ECHO 1>&2 "Could not find chipset file" && return
    ARCH=$($PRTCONF | $HEAD -5 | $TAIL -1 | $CUT -d, -f2)
    [ -z "$ARCH" ] && $ECHO 1>&2 "Could not find architecture" && return
    CHIPSET=$($GREP -w "$ARCH" $CHIPSETFILE | $CUT -d, -f2 | $HEAD -1)
    [ -z "$CHIPSET" ] && $ECHO 1>&2 "Could not find $ARCH in $CHIPSETFILE" && return
    $ECHO "$CHIPSET"
}

##
# Get chipspecific version
#  Take a path and attempt to find a processor specific version of it.
#  such as OPENSSL, or httpd.  If the specified location cannot be found then blows up.
# Accepts the @CHIPSET@ macro
##

getChipsetSpecificPath() {
    [ $# -ne 1 ] && $ECHO 1>&2 "Incorrect # of getChipsetSpecificPath arguments" && exit 1
    #If no chipset is found, default to niagara
    # If no target is found with that chipset, try blank
    TARGET=$1
    CHIPSET=`getChipset`

    for x in -$CHIPSET -niagara ''; do
        TMPTARGET=$TARGET
        TMPTARGET=${TMPTARGET//@CHIPSET@/$x}
        [ -e $TMPTARGET ] && $ECHO $TMPTARGET && return
    done

    #If we are here then nothing matched
    $ECHO 1>&2 "Could not find matching target for $TARGET" && exit 1
}

##
# Stop Sessions
# F5s do stopsessions via SOAP. A10s do it via changing the healthcheck file.
###
stopSessions() {
    [ $# -ne 1 ] && $ECHO 1>&2 "Incorrect # of stopSessions arguments" && exit 1
    INSTANCE_NAME=$1
    ADDRESS=$(getAddress)

    callHelper $HOOKS_DIR/$PRE_STOP_SESSIONS

    $ECHO "Stopping sessions of $INSTANCE_NAME"
    ERROR=0
    pools=$(getF5Pools $INSTANCE_NAME)

    touch /sites/utils/tmp/$INSTANCE_NAME.disable && $CHMOD 666 /sites/utils/tmp/$INSTANCE_NAME.disable

    for POOLINFO in $pools; do
        F5SERVER=$($ECHO $POOLINFO | $CUT -d\| -f 1)
        F5POOL=$($ECHO $POOLINFO | $CUT -d\| -f 2)
        #POOL example: pSTANDALONE_443,
        PORT_STUB=$($ECHO $POOLINFO | $SED -e 's/_/ /g' | $AWK '{print $NF}')
        # 443/ 80 for most, or 19443 for fulfillment

        #fulfillment, vend pool names are their exact listening port.
        if [ $PORT_STUB -gt 999 ]; then
            PORT=$PORT_STUB
        else
            # Some virtual servers listen on high ports, so we check for
            PORT=$(( $($ECHO $INSTANCE | $CUT -d"-" -f2) * 1000 + $PORT_STUB ))
        fi

        #Determine if this is a a10 or F5 call
        expr "$F5POOL" : "ap" >/dev/null && IS10=1


        if [ -n "$IS10" ]; then
            #Enable the port, in case it was previously disabled
            SESSIONID=`$WGET "https://$F5SERVER/services/rest/V1.1/?method=authenticate&username=${A10USER}&password=${A10PASS}"  --no-check-certificate -O- -q | $CUT -d\< -f 4 | $CUT -d\> -f 2`
            $WGET "https://$F5SERVER/services/rest/V1.1/?session_id=$SESSIONID&method=slb.server.update&address=$ADDRESS&port-list=port1&port1=port_num%03$PORT%02protocol%032%02status%031"  --no-check-certificate -O- -q |xmllint --format -| $GREP -w ok >/dev/null 2>&1
            RESULT=$?
            $ECHO "$F5SERVER:$PORT state set to 'STATE_DISABLED/STATE_ENABLED"
            if [ $RESULT -eq 0 ]; then
                $ECHO "Suspend returned success for $F5SERVER|$F5POOL"
            else
                $ECHO "Suspend failed for $F5SERVER|$F5POOL"
            fi
        else
            $F5TOOL $F5SERVER $F5POOL $ADDRESS:$PORT disable
            RETCODE=$?

            if [ $RETCODE -ne 0 ]; then
                $ECHO "ERROR: disable returned nonzero returncode for $POOLINFO"
                let ERROR=ERROR+1
            else
                $ECHO "Suspend returned success for $POOLINFO"
            fi
        fi
    done


    callHelper $HOOKS_DIR/$POST_STOP_SESSIONS

    return $ERROR
}

##
# Start Sessions
###
startSessions() {
    [ $# -ne 1 ] && $ECHO 1>&2 "Incorrect # of startSessions arguments" && exit 1
    INSTANCE_NAME=$1
    ADDRESS=$(getAddress)

    callHelper $HOOKS_DIR/$PRE_START_SESSIONS

    $ECHO "Starting sessions of $INSTANCE_NAME"
    ERROR=0

    pools=$(getF5Pools $INSTANCE_NAME)
    [[ -e  /sites/utils/tmp/$INSTANCE_NAME.disable ]] && rm -f /sites/utils/tmp/$INSTANCE_NAME.disable

    for POOLINFO in $pools; do
        F5SERVER=$($ECHO $POOLINFO | $CUT -d\| -f 1)
        F5POOL=$($ECHO $POOLINFO | $CUT -d\| -f 2)
        #POOL example: pSTANDALONE_443,
        PORT_STUB=$($ECHO $POOLINFO | $SED -e 's/_/ /g' | $AWK '{print $NF}')
        # 443/ 80 for most, or 19443 for fulfillment

        #fulfillment, vend pool names are their exact listening port.
        if [ $PORT_STUB -gt 999 ]; then
            PORT=$PORT_STUB
        else
            # Some virtual servers listen on high ports, so we check for
            PORT=$(( $($ECHO $INSTANCE | $CUT -d"-" -f2) * 1000 + $PORT_STUB ))
        fi

        #Determine if this is a a10 or F5 call
        expr "$F5POOL" : "ap" >/dev/null && IS10=1


        if [ -n "$IS10" ]; then
            SESSIONID=`$WGET "https://$F5SERVER/services/rest/V1.1/?method=authenticate&username=${A10USER}&password=${A10PASS}"  --no-check-certificate -O- -q | cut -d\< -f 4 | cut -d\> -f 2`
            $WGET "https://$F5SERVER/services/rest/V1.1/?session_id=$SESSIONID&method=slb.server.update&address=$ADDRESS&port-list=port1&port1=port_num%03$PORT%02protocol%032%02status%031"  --no-check-certificate -O- -q |xmllint --format -| $GREP -w ok >/dev/null 2>&1
            RESULT=$?
            $ECHO "$F5SERVER:$PORT state set to 'STATE_ENABLED/STATE_ENABLED"
            if [ $RESULT -eq 0 ]; then
                $ECHO "Enable returned success for $F5SERVER|$F5POOL"
            else
                $ECHO "Enable failed for $F5SERVER|$F5POOL"
            fi
        else
            $F5TOOL $F5SERVER $F5POOL $ADDRESS:$PORT enable
            RETCODE=$?

            if [ $RETCODE -ne 0 ]; then
                $ECHO "ERROR: enable returned nonzero returncode for $POOLINFO"
                let ERROR=ERROR+1
            else
                $ECHO "Enable returned success for $POOLINFO"
            fi
        fi
    done


    callHelper $HOOKS_DIR/$POST_START_SESSIONS

    return $ERROR
}

##
# Kill Sessions
###
killSessions() {
    [ $# -ne 1 ] && $ECHO 1>&2 "Incorrect # of startSessions arguments" && exit 1
    INSTANCE_NAME=$1
    ADDRESS=$(getAddress)

    callHelper $HOOKS_DIR/$PRE_KILL_SESSIONS

    $ECHO "Killing sessions of $INSTANCE_NAME"
    ERROR=0

    touch /sites/utils/tmp/$INSTANCE_NAME.disable && $CHMOD 666 /sites/utils/tmp/$INSTANCE_NAME.disable

    pools=$(getF5Pools $INSTANCE_NAME)
    for POOLINFO in $pools; do
        F5SERVER=$($ECHO $POOLINFO | $CUT -d\| -f 1)
        F5POOL=$($ECHO $POOLINFO | $CUT -d\| -f 2)
        #POOL example: pSTANDALONE_443,
        PORT_STUB=$($ECHO $POOLINFO | $SED -e 's/_/ /g' | $AWK '{print $NF}')
        # 443/ 80 for most, or 19443 for fulfillment

        #fulfillment, vend pool names are their exact listening port.
        if [ $PORT_STUB -gt 999 ]; then
            PORT=$PORT_STUB
        else
            # Some virtual servers listen on high ports, so we check for
            PORT=$(( $($ECHO $INSTANCE | $CUT -d"-" -f2) * 1000 + $PORT_STUB ))
        fi

        #Determine if this is a a10 or F5 call
        expr "$F5POOL" : "ap" >/dev/null && IS10=1

        if [ -n "$IS10" ]; then
            #Remove the disable file and enable the port, in case it was previously disabled
            SESSIONID=`$WGET "https://$F5SERVER/services/rest/V1.1/?method=authenticate&username=${A10USER}&password=${A10PASS}" --no-check-certificate -O- -q | cut -d\< -f 4 | cut -d\> -f 2`
            $WGET "https://$F5SERVER/services/rest/V1.1/?session_id=$SESSIONID&method=slb.server.update&address=$ADDRESS&port-list=port1&port1=port_num%03$PORT%02protocol%032%02status%030"  --no-check-certificate -O- -q |xmllint --format -| $GREP -w ok >/dev/null 2>&1
            RESULT=$?
            $ECHO "$F5SERVER:$PORT state set to 'STATE_DISABLED/STATE_DISABLED"
            if [ $RESULT -eq 0 ]; then
                $ECHO "Kill returned success for $F5SERVER|$F5POOL"
            else
                $ECHO "Kill failed for $F5SERVER|$F5POOL"
            fi
        else

            $F5TOOL $F5SERVER $F5POOL $ADDRESS:$PORT kill
            RETCODE=$?

            if [ $RETCODE -ne 0 ]; then
                $ECHO "ERROR: Kill returned nonzero returncode for $POOLINFO"
                let ERROR=ERROR+1
            else
                $ECHO "Kill returned success for $POOLINFO"
            fi
        fi
    done

    callHelper $HOOKS_DIR/$POST_KILL_SESSIONS

    return $ERROR
}

##
# Restart Monitor Scripts
###
restartMonitors() {
    $WLTAILER stop
    $SNMPSUBAGENT stop
    $SLEEP 2
    $PS -ef | $EGREP '(jmxgetbea|snmpsuba)'| $AWK '{print $2}' | $XARGS $KILL
    $SLEEP 2
    $WLTAILER start
    $SLEEP 2
    $SNMPSUBAGENT start
}

##
# Rotate Logs
###
rotateLogs() {
    logs=$($LS $LOGDIR/*${INSTANCE}.log 2>/dev/null)
    if [ -n "$logs" ]; then
        local dt=$($DATE +%Y%m%d)
        for log in $logs; do
            log=$(basename $log)
            $CMDPREFIX "$MV $LOGDIR/$log $LOGDIR/archives/$log-$dt"
            if [ $? -ne 0 ]; then
                echo "Could not move file $log to archives"
                return 1
            fi
            $CMDPREFIX "$NICE $GZIP -f $LOGDIR/archives/$log-$dt </dev/null >/dev/null 2>/dev/null &"
        done
    else
        $ECHO "No logs to rotate"
        return 1
    fi

    # tell nginx to rotate logs
    setupEnv
    $CMDPREFIX "${NGINX_CMD} -s reopen"
}

##
# Flush Logs from memory
##
flushLogs() {
    echo 'Flushing nginx logs.'
        setupEnv
        $CMDPREFIX "${NGINX_CMD} -s reopen"
}

##
# Reload nginx
##
reloadNginx() {
    echo 'Reloading nginx process.'
    setupEnv
    $CMDPREFIX "${NGINX_CMD} -s reload"   
}

clearCache() {
    local envname="$($ECHO $INSTANCE | $CUT -d - -f 1)"
    echo "Clearing cache by rm /tmp/.nginx_*_$INSTANCE /sites/utils/tmp/.nginx_*_$INSTANCE /tmp/.nginx_*_$envname /sites/utils/tmp/.nginx_*_$envname"
    $CMDPREFIX "rm -rf /tmp/.nginx_*_$INSTANCE /sites/utils/tmp/.nginx_*_$INSTANCE /tmp/.nginx_*_$envname /sites/utils/tmp/.nginx_*_$envname"
    reloadNginx   
}

##
# Main
###
main() {
    # Check that command line was complete
    if [ ! -n "$INSTANCE"  -o  ! -n "$COMMAND" ]; then
        usage
        exit $?
    fi

    # Must be run as atg, www or root
    if [ "$ME" != "root" -a "$ME" != "www" -a "$ME" != 'atg' ]; then
        $ECHO "You must be root or the www or atg user to run this script."
        exit 1
    fi

    # Check that required tools work
    for x in CTLATTRIBUTETOOL WGET PS; do
        eval value=\$$x
        if [ ! -x "$value" ]; then
            $ECHO "Unable to execute $x: $value, results indeterminate" >&2
            exit 1
        fi
    done

    # Check for F5 tool
    if [ ! -f $F5TOOL ]; then
        $ECHO "Not found F5TOOL: $F5TOOL , aborting." >&2
        exit 1
    fi

    # Check for config file's existence
    if [ ! -e $CFGFILE ]; then
        $ECHO "$CFGFILE not found, aborting." >&2
        exit 1
    fi

    ###
    # If we are on privileged port (< 1024) then run as root, otherwise we'll run as www in the command prefix.
    # This will ignore lines that start with a # in the first column.
    ###

    # get list of ports this instance listens on
    LISTENPORTS=$($GREP -E '^[\t ]*Listen[\t ]+' $CFGFILE | $SED 's/^[ \t]*Listen[\t ]*//' | $SED 's/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*://')

    # cycle through list and see if any are privileged
    ROOT=0
    LISTEN=0
    for port in $LISTENPORTS
    do
        LISTEN=1
        [ $port -lt 1024 ] && ROOT=1
    done

    if [ $LISTEN -eq 1 ]; then
        if [ $ROOT -eq 1 ]; then
            if [ "$ME" = "root" ]; then
                CMDPREFIX="$SH -c"
            else
                $ECHO "Listen port is privileged and this script was not run as root.  Aborting."
                exit 1
            fi
        else
            if [ "$ME" = "www" ]; then
                CMDPREFIX="$SH -c"
            elif [ "$ME" = 'root' ]; then
                CMDPREFIX="$SU - www -c"
            else
                CMDPREFIX="$SUDO $SU - www -c"
            fi
        fi
    else # for some reason we did not find a Listen port so default to using sudo
        CMDPREFIX="$SUDO $SU - www -c"
    fi


    # Define DATACENTER and verify it is set.
    DATACENTER=${DATACENTER:-$($CTLATTRIBUTETOOL $CTLFILE $HOSTNAME $INSTANCE datacenter)}
    if [ -z "$DATACENTER" ]; then
        $ECHO "No datacenter defined for this instance --  update the ctl input file. Aborting." >&2
        exit 1
    fi

    # Get the chipset specific httpd,openssl
    if [ "$OS_TYPE" = 'SunOS' ]; then
        NGINX=`getChipsetSpecificPath $NGINX`
        OPENSSL=`getChipsetSpecificPath $OPENSSL`
    fi

    LD_LIBRARY_PATH=$OPENSSL/lib:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH

    # Process Command
    case $COMMAND in
        start|stop) startOrStopCmd $COMMAND; exit $?
        ;;
        reload) reloadNginx; exit $?
        ;;
        restart) startOrStopCmd stop; sleep 5; startOrStopCmd start; exit $?
        ;;
        kill) killCmd; exit $?
        ;;
        status) fullStatus $INSTANCE; exit $?
        ;;
        f5status) f5Status $INSTANCE; exit $?
        ;;
        restartmonitors) restartMonitors; exit $?
        ;;
        startsessions) startSessions $INSTANCE; exit $?
        ;;
        stopsessions) stopSessions $INSTANCE; exit $?
        ;;
        killsessions) killSessions $INSTANCE; exit $?
        ;;
        clearcache) clearCache; exit $?
        ;;
        flushlog|flushlogs) flushLogs; exit $?
        ;;
        rotatelog|rotatelogs) rotateLogs; exit $?
        ;;
        help|*) usage; exit 1
        ;;
    esac
}

## Main ##
main $@

Script to add/remove init scripts and rc*.d links for programs using ctl scripts.

#!/bin/bash
###################################################################################
#
# ctlrc.sh
#
# Script to add/remove init scripts and rc*.d links for programs using ctl scripts.
#
# Relies on etc/ctlrc.conf for configuration
#
# @(#)$Id$
# $URL$
###################################################################################

#Setup our base
BASEDIR=/sites/utils/local

# Load TAPS globals
source $BASEDIR/lib/loadglobals.sh
[ $? -ne 0 ] && exit 1

TYPE=""
INSTANCE=""
ACTION_ADD=0
ACTION_RM=0
ACTION_LIST=0
AUTO=0
VERBOSE=0
STARTDIR="rc3.d"
STOPDIRS="rc0.d rc1.d rc2.d"
CONF="$BASEDIR/etc/ctlrc.conf"
ETC="/etc"

##
# Usage
###
usage() {
    $ECHO "Usage: $0 -a -i <instance> -t <type> -[yv]"
    $ECHO "       $0 -r -i <instance> -t <type> -[yv]"
    $ECHO "       $0 -l"
    $ECHO "       -a    Add init script and links"
    $ECHO "       -r    Remove init script and links"
    $ECHO "       -t    Type of init script (use -l to find available types)"
    $ECHO "       -l    List available types"
    $ECHO "       -i    Instance name"
    $ECHO "       -y    Run without confirmation prompt"
    $ECHO "       -v    Verbose output"
    exit $1
}

##
# Get Types
###
getTypes() {
    types=`$GREP -v ^# $CONF | $AWK -F: '{print $1}'`
    $ECHO $types
}

##
# Confirm
###
confirm() {
        action=$1
    if [ $AUTO -ne 0 ]; then
        return 0
    fi
      $ECHO "Will $action script $initFile"
        $ECHO "Will $action link $initSFile"
        for dir in $STOPDIRS; do
            $ECHO "Will $action link ${ETC}/${dir}/${initKFile}"
        done
        $PRINTF "Do you wish to continue? [yN] "
        read confirm
        if [ "$confirm" != "y" -a "$confirm" != "Y" ]; then
            return 1
        else
            return 0
        fi
}

##
# Add All
###
addAll() {
    confirm "add" || return 1
        if [ $VERBOSE -eq 1 ]; then
        $ECHO "Creating init script $initFile";
        fi
        $CAT >$initFile 2>&1 <<EOF
#!/bin/sh
# This script is autogenerated by /sites/utils/local/bin/ctlrc

INSTANCE=$INSTANCE
CTL=$ctlScript

if [ ! -x "\$CTL" ]; then
    $ECHO "Unable to locate \$CTL"
    exit 2
fi

exec \$CTL \$INSTANCE \$1
EOF
        [ $? -ne 0 ] && return 1
        if [ $VERBOSE -eq 1 ]; then
            $ECHO "Setting execute permissions on $initFile"
        fi
       
        $CHMOD 755 $initFile
        if [ $VERBOSE -eq 1 ]; then
            $ECHO "Creating symlink to $initSFile"
        fi
       
        $LN -s $initFile $initSFile
        [ $? -ne 0 ] && return 1
       
        for dir in $STOPDIRS; do
        t=${ETC}/${dir}/${initKFile}
            if [ $VERBOSE -eq 1 ]; then
                $ECHO "Creating symlink to $t"
            fi
            $LN -s $initFile $t
            [ $? -ne 0 ] && return 1
        done
       
        return 0
}

##
# Remove All
###
removeAll() {
    confirm "remove" || return 1

    if [ -f $initFile ]; then
        if [ $VERBOSE -eq 1 ]; then
            $ECHO "Removing $initFile"
        fi
        $RM -f $initFile || return 1
    fi

    if [ -h $initSFile ]; then
        if [ $VERBOSE -eq 1 ]; then
            $ECHO "Removing $initSFile"
        fi
        $RM -f $initSFile || return 1
    fi

    for dir in $STOPDIRS; do
        t="${ETC}/${dir}/${initKFile}"
        if [ -h $t ]; then
            if [ $VERBOSE -eq 1 ]; then
                $ECHO "Removing $t"
            fi
            $RM -f $t || return 1
        fi
    done
    return 0
}

##
# Check Arguments
###
checkArgs() {
    if [ $ACTION_LIST -eq 1 ]; then
        return 0
    elif [ $ACTION_ADD -eq 1 -a $ACTION_RM -eq 1 ]; then
        $ECHO "Option -a and -r are not compatible"
        return 1
    elif [ -z "$TYPE" ]; then
        $ECHO "You must provide a type"
        return 1
    elif (! $GREP ^$TYPE $CONF >/dev/null 2>&1); then
        $ECHO "No such type $TYPE"
        return 1
    elif [ "$instanceRequired" -eq 1 -a ! "$INSTANCE" ]; then
        $ECHO "You must provide an instance name"
        return 1
    fi
    return 0
}

### Main ###

# Check command line options
[ $# -eq 0 ] && usage 1

while getopts t:i:arlyvh op; do
    case $op in
        t) TYPE=$OPTARG
            ;;
        i) INSTANCE=$OPTARG
            ;;
        a) ACTION_ADD=1
            ;;
        r) ACTION_RM=1
            ;;
        l) ACTION_LIST=1
            ;;
        y) AUTO=1
            ;;
        v) VERBOSE=1
            ;;
        h) usage 0
            ;;
        *) usage 1
            ;;
    esac
done

instanceRequired=`$GREP ^$TYPE $CONF | $CUT -d: -f2`

checkArgs || usage 1

baseName=`$GREP ^$TYPE $CONF | $CUT -d : -f 3`
priority=`$GREP ^$TYPE $CONF | $CUT -d : -f 4`
ctlScript=`$GREP ^$TYPE $CONF | $CUT -d : -f 5`

if [ -z "$INSTANCE" ]; then
    initFile=${ETC}/init.d/${baseName}
    initSFile=${ETC}/${STARTDIR}/S${priority}${baseName}
    initKFile=K${priority}${baseName}
else
    initFile=${ETC}/init.d/${baseName}_${INSTANCE}
    initSFile=${ETC}/${STARTDIR}/S${priority}${baseName}_${INSTANCE}
    initKFile=K${priority}${baseName}_${INSTANCE}
fi

if [ $ACTION_LIST -eq 1 ]; then
    getTypes
    exit $?
elif [ $ACTION_ADD -eq 1 ]; then
    addAll
    exit $?
elif [ $ACTION_RM  -eq 1 ]; then
    removeAll
    exit $?
fi

Common UNIX scripts

#!/bin/bash

IFS=$'\n'
sum_result=`ctl -C "$@" -a type=weblogic -q -m "fgrep 'Server state changed' /sites/servers/@INSTANCE@/logs/console.log | tail -1" | sed 's/Result://g'`;
sum_result=${sum_result/Result:/};

for result in $sum_result;
do
  echo $result;
done;

==========================
To find out status

==========================
#!/bin/bash

IFS=$'\n'
sum_result=`ctl -C "$@" -a type=weblogic -q -m "fgrep 'Server state changed' /sites/servers/@INSTANCE@/logs/console.log | tail -1" | sed 's/Result://g'`;
sum_result=${sum_result/Result:/};

for result in $sum_result;
do
  echo $result;
done;

==========================
To find 
==========================

_user='admin'
_pass='Rm0nly!'
_host=stg1b2cdserv01.cingular.com
_port=8210

curl -u "${_user}:${_port}" "http://${_host}:${_port}/system/att/dcs-tool?job=301template-for-detailspages&src=/content/att/shop&dest=/content/att&product-type=device&platform=desktop&tag=1407Ma_supplement&dryrun=y" > out.json


==========================
DB Connect Script

==========================


#!/bin/bash

SCRIPT_HOME=/sites/utils/local/bin
ORACLE_HOME=/opt/oracle/product/10.2.0/client_1
ORACLE_SID=tapsdb1.world
CONFIG=$SCRIPT_HOME/config/



$ORACLE_HOME/bin/sqlplus -s <<! 2>&1 > $LOG_FILE
  ${SB_LOGIN}/${SB_PWD}@${ORACLE_SID}


==========================
JDBC Info 

==========================
#!/bin/bash
# @(#)$Id: jdbcinfo.sh 53624 2008-05-21 22:56:52Z jw089a $
# Wrapper script for jdbcinfo.py.

WL_BASE=$(/sites/utils/local/libexec/findWL.sh mjobA) || { echo "$WL_BASE"; exit 1; }
WLST=$WL_BASE/common/bin/wlst.sh
SCRIPT=/sites/utils/local/bin/jdbcinfo.py
USER=
PASSWORD=
PORT=
RESOURCE=

usage()
{
    echo "Usage: $0 -u username -p password -P port -r resource"
    exit $1
}

if [ $# -ne 8 ]; then
    usage 1
fi
while getopts hu:p:P:r: opt; do
    case $opt in
    h) usage 0;;
    u) USER=$OPTARG;;
    p) PASSWORD=$OPTARG;;
    P) PORT=$OPTARG;;
    r) RESOURCE=$OPTARG;;
    esac
done

out=`$WLST $SCRIPT -u $USER -p $PASSWORD -P $PORT -r $RESOURCE | grep '^DB'` || exit $?
for line in $out; do
    echo $line
done
exit 0

Sunday, October 14, 2018

Artificial Intelligence course from MIT in 6 weeks



Orientation Module: Welcome to Your Online Campus


You’ll be welcomed with a personal call and get introduced to your online teaching and technical support network. Begin connecting with fellow participants while exploring the navigation and tools of your Online Campus. Be alerted to key milestones in the learning path, and review how your results will be calculated and distributed. You’ll be required to complete your participant profile, confirm your certificate delivery address, and submit a digital copy of your passport/identity document.



Module 1: An Introduction to Artificial Intelligence


This introductory module guides you through the evolution of key AI technologies and how they have developed to transform industry and business practice. The relationship between AI and collective intelligence, as well as the implications of this partnership for business strategy and society are also introduced. As part of an ongoing project, you’ll begin to consider your own organization in terms of the application of AI technologies.




Module 2: Machine Learning in Business

In this module, you’ll explore the core concepts of machine learning – an AI technology which aims to design, understand, and use computer programs to learn from experience. Discover how machine learning can be successfully integrated into business functions through rich case studies and faculty-led videos that examine the opportunities that this subfield of AI affords. For your ongoing project, you’ll propose ideas for the application of machine learning in a business context of your choice.




Module 3: Natural Language Processing in Business


This module is devoted to natural language processing (NLP), an AI technology developed to intelligently process human language. Through rich case studies and faculty-led videos, which explore functions such as machine translation, summarization, and sentiment analysis, you’ll learn how NLP can be skillfully deployed in a series of business contexts. For the next part of your project, the focus will shift to NLP and its strategic implementation in a business context of your choice.




Module 4: Robotics in Business


This module delves into the key elements of robotics as a transformative AI technology, with a focus on automating processes and tasks. Through rich case studies and facultyled videos that survey robots and autonomous vehicles, you’ll learn how robotics can benefit an organization. You’ll have the opportunity, once more, to submit ideas regarding the potential for robotics to be deployed in a business context of your choice.




Module 5: Artificial Intelligence in Business and Society


In this module, you’ll see examples of other kinds of AI as well as return to collective intelligence and the human-machine relationship. Here you’ll also consider the impact of AI on jobs, and the ethical and social implications of AI integration. You’ll be tasked with anticipating and planning for the risks and considerations that may apply to integrating AI in a business context of your choice.




Module 6: The Future of Artificial Intelligence


This module will allow you to imagine the future of AI and its potential use in your organization. Using what you have learned from the previous modules, you’ll create a business roadmap for the strategic implementation of AI and collective intelligence into an organization of your choice.




Sunday, September 30, 2018

Oracle WebLogic Server 12c Administration I (1Z0-133) - Full

You got 56 of 75 possible points.
Your score: 75 %

Question Results

Score 1 of 1
Question:
A WebLogic Server instance can have multiple network channel for it.
Each channel for the server must have a unique combination of two element. Identify these two elements.
Response:
Channel weight
Tunneling enabled
Listen address
Listen port
Score 1 of 1
Question:
You need to monitor the HTTP session count for a running web application.
Identify three ways to perform this monitoring.
Response:
Use the application’s Monitoring tab in the Administration console .
Run the jstat tool in your JDK.
Write and run a custom WLST script.
Use the Monitoring Dashboard in the Administration console.
Use the cloud control page in the Administration console.
Score 1 of 1
Question:
As the technical lead for your project, you have been asked to recommend a new solution to handle frequently increasing loads on your applications. The Weblogic 12.1.2 domain currently runs with two clusters of three servers with request being filtered and passed by a proxy server that users the round –robin algorithm. 
However, the load sometimes exceeds the maximum capacity of all these servers combined but your domain lacks in scalability.
What is the best implementation solution?
Response:
Replace the software load balancer with a hardware load balancer.
Tune work managers to optimize work.
Modify the proxy server load balancing algorithm to weight based.
Configure dynamic clusters and specify the number of server instances you anticipate at needing at peak load.
Add a third cluster and spread existing server instances across the clusters.
Score 1 of 1
Question:
A WebLogic server domain contains a dynamic cluster called “cluster1”.The cluster “cluster”1 has two dynamic managed servers “server1” and “server2”. There is a need to view the inherited attribute values for “server2”.
How do you view all attributes of “server2”.including those inherited from the server template?
Response:
Use java weblogic.Deployer.
You cannot, because attribute values are not inherited.
Use WLST.
Use WebLogic Administration console >”server” link.
Score 0 of 1
Question:
In the certification matrix for your version of WebLogic Server , you find the row for your database and its version. In that row, in the “type of database use” column, it says “application data access only”.
Your database cannot be used __________.
Response:
In a production environment
By an Enterprise JavaBean
By a multidata source
By the administration server
For internal data storage by WebLogic server
Score 1 of 1
Question:
A global (distributed) transaction involves more than one _______________________.
Response:
WebLogic Server
Transactional resource
Domain
Cluster
Continent
Score 1 of 1
Question:
You are in the process of planning a deployment in which a single WebLogic cluster will host a web application. There are several options to consider.
Which is not a valid decision?
Response:
Replicated or persistent HTTP sessions
Proxy plug-in or hardware load balancer
Single or multiple domains
Unicast or multicast communication
Configured or dynamic cluster
Score 1 of 1
Question:
A web application is configured for in-memory replication and is deployed to a cluster. This cluster is distributed across two buildings on a university campus. For performance reasons, you requires that session replication occur within the building whenever possible.
How do you implement this requirement?
Response:
Configure the application’s cookies parameters.
Disable the dynamic server list in the proxy plug –in.
Configure each server’s replication group.
Configure the cluster to use multicast communication.
Score 1 of 1
Question:
A WebLogic server (WLS) domain was recently updated from WLS 10.3.6 to WLS 12.12.
What is the mode of operation of the Node Manager after the update and what is needed to keep the same behavior as in WLS 10.3.6?
Response:
Node Manager mode of operating and behavior can be selected in reconfiguration Wizard.
Nothing, Node Manager runs and behaves the same on both WLS versions
Node manager runs in “per domain” mode and requires manual steps to return to the “per machine” mode, used in WLS10.3.6.
Node Manager runs in “per machine” mode and nothing is needed to keep the same behavior.
Score 1 of 1
Question:
You use the Java –based Node Manager to start your managed servers. You want Node Manager to:
• Stop servers by using your custom stop script : mystopit.sh
• Restart servers when the hardware cases
• Use SSL communication
• Check server heath once per second
Below are portions of the node manager. properties file. Select the one that configures Node manager as described.
Response:
StopScriptEnabled=true
StopScriptName=mystopic.sh
CrashRestartEnabled=true
SecureListtenser=true
StateCheckinterval=1000
stopscriptenabled=true
Stopscriptname=mystopit.sh
crashRecoveryEnabled=true
secureListener=SSL
statecheckinterval=1000
StopscriptEnabled=true
StopScriptName=topic-sh
CrashRecoveryEnabled=true
SecureListtener=true
Statecheckinterval=1000
StopsScriptEnabled=true
StopScriptName=mystopit.sh
CrashRestartEnabled=true
SecureListener=true
StataCheckInterval=1
StopScript=true
StopscriptName=mystopit.sh
CrashRecoveryEnabled=true
SecureListtenser=true
Score 0 of 1
Question:
You want to configure WebLogic server transactions to be recoverable when a nonclustered managed server crashes, even if that crash is caused by an unrecoverable hardware failure. You want to run the managed server on different hardware, and have it recover the transactions that were in-progress at the time of the crash.
You also want to use the default store for transaction logs.
Which statement is true?
Response:
Before the crash ,you need to update the path to the default store for the managed server. The path should be to some shared storage location.
This scenario is common , and so the default configuration of the default store works.
After the crash, obtain a copy of the managed server’s default store from the administration server. Move it to the same relative location on the new hardware before starting the managed server there.
This scenario is not possible .You must use the JDBC store to recover transactions from a crashed server.
This scenario is not possible. You must use clustered managed servers to recover transactions from a crashed server.
Score 1 of 1
Question:
You are deploying a web application called inventory, war. It has been installed and has the state of “prepared”. It is targeted to the Managed server named managed1.The web application’ context root is /inventory and the starting page is index .jap.
However ,you want to test the application before allowing end users access to it. In the administration console, you select inventory. war, and then select Start and “servicing only administration request.”
In you web browser, you need to enter a host and port followed by /inventory /index.jap.
Which host and port would you use?
Response:
Administration Serve host and port
managed1 host and Administration port
Administration server host and Administration port
managed1 host and port
Score 0 of 1
Question:
You shut down a managed server by using the administration console.
Which statement is always true?
Response:
You can choose to shut down the server right away or after it completes its work.
The managed server was running on the same machine as the administration server.
The administration console calls WLST to accomplish the shutdown.
Node Manager is configured properly and running on the managed server’s machine.
Score 0 of 1
Question:
You decide to use a database to store WebLogic Server transaction logs for a managed server.
Which two steps are required to configure this?
Response:
Under the managed server's Services configuration select “JDBC” as the type for the transaction log store.
Under the managed server's Services configuration, select "Disable the Default Store
Create an XA data source in the domain for the database transaction log.
Create a non XA data source in the domain for the database transaction log.
Score 1 of 1
Question:
A replication channel is:
Response:
A network channel used by cluster members for peer-topeer communication
The title of the tab in the Monitoring Dashboard that shows cluster charts
Another name for the preferred secondary group
Another name for replication group
Score 0 of 1
Question:
Identify two reasons for defining machines and assigning servers to them in WebLogic servers.
Response:
WebLogic Server users server machine assignments to help it choose servers in a cluster on which to replicate session state.
A machine definition is required to configured figure the Node Manager.
To reference an instance of WebLogic Server, you must know its machine and port.
A machine’s Cluster Weight attribute may be used by load balancers to help them determine how often to send requests to servers assigned to that machine.
A machine is a required organizational unit. A domain contains machines and machines contain servers.
A machine can be the proxy to a cluster.
Score 0 of 1
Question:
You are creating and configuring a cluster by using the administration console. Which two statements are true?
Response:
You must pick the cluster messaging mode.
All servers that will be part of the cluster must be created before the cluster is created.
Once the cluster is created, you cannot change its messaging mode.
The administration console does not provide a way to manually migrate singleton services. It must be set up to be done automatically or by using WLST.
Even though you create a non dynamic cluster, you can change it to a dynamic cluster .
Score 1 of 1
Question:
The startManagedWebLogic.sh script takes two parameters. They are:
Response:
The name of the admin server and the URL of the managed server
The name of the admin server and the URL of the admin server
The name of the managed server and the URL of the admin server
The name of the managed server and the URL of the managed server
Score 1 of 1
Question:
Which three statements are true about the administration console?
Response:
The context path of the administration console may be changed.
If the domain’s Administration port is enabled, access to the administration console must be made only through that port.
If a domain is in production Mode, access to the administration console must be made through a secure port.
The administration console can be disabled.
If a domain is in Development Mode the administration console no longer requires an administration –level user when logging in.
Score 0 of 1
Question:
You use the Administration console to modify the domain’s security realm. After deleting the default authentication provider, you add a single authentication provider for iplanet LDAP. You then try to reboot your servers with the weblogic user but they all fail to start due to authentication errors.
Identify two possible causes.
Response:
The weblogic user does not exist in iplanet.
A domain must include the default authentication provider.
LDAP providers cannot be included in the default security realm.
The Administrators group does not exist in iplanet.
Iplanet is not a supported LDAP implementation.
Score 1 of 1
Question:
Which list of severity levels is in order from bad to worse?
Response:
ERROR, CRITICAL, EMERGENCY, ALERT
ALERT, ERROR, CRITICAL, EMERGENCY
ERROR, CRITICAL, ALERT, EMERGENCY
ERROR, ALERT, CRITICAL, EMERGENCY
Score 1 of 1
Question:
You use a web browser to log in to a application that is deployed to WebLogic server. When you click a link named “publish” on the site, an Access Denied” message appears.
Which two statements are true about this server’s security configuration?
Response:
Your user account exists in an authentication provider.
The application is not associated with any security roles.
Your user account has expired.
A security realms is not configured in this domain.
A security policy is attached to the “publish” link URL.
Score 0 of 1
Question:
Which three statements are true about WebLogic clusters?
Response:
Web applications require a proxy in order to be used in a cluster.
All cluster members must bind to the same port number.
Cluster members can be associated with one or more domains.
Cluster members replicate application data by using heartbeats.
EJB applications can be targeted to entire cluster.
Clusters provide clients with transparent failover.
Score 0 of 1
Question:
You plan to Install WeblLogic Server by using the genetic JAR installer in silent mode.
What are two ways to create the required response file?
Response:
The genetic JAR installer does not have a silent mode .so you do not need a response file when using this installer.
First install or deinstall graphically. There is an option to save a response file.
The response file is not required. You can answer questions interactively at the command line.
First run the Repository creation utility. There is an option to save a response file .
Use the sample response file in the installation documentation as a template.
Score 1 of 1
Question:
You created a shutdown class Myclass that you would like to execute just before server shutdown.
Which statement is true regarding Myclass?
Response:
Myclass must not have a main method.
Myclass can be specified in the Configuration Wizard as a shutdown class.
Myclass can be targeted to only one server instance.
Myclass must be available in the WebLogic server’s classpath.
Score 1 of 1
Question:
View the following file excerpt, which configures HTTP session replication:
< session-descriptor >
< persistent-store-type > replicated </persistent-store-type >
</session-descriptor >
From which file is this except taken?
Response:
Session-xm1
Weblogic-xm1
Config-xm1
Weblogic –application.xm1
0 Web.xm1
Score 1 of 1
Question:
One Managed Server that is part of a large domain throws java.lang.out of Memory error (OOM) occasionally.
You have been monitoring this server with the jvisualVM tool but that didn’t help because the issue occurs infrequently and not a specific scenario. So you decided to force the server to dump the heap memory as soon as an OOM gets thrown in order to analyze the dump file later.
How do you modify the Java HotSpot Startup command to enable this feature and save the dump in the directory D:\hprof-dumps\?
Response:
Add –xx:+DumpHeaponoutofmemory-xx:Dumppath=D:\hprof.
Add-xx:+HeapDumponoutofMemoryExecepttion-xx:HeapDumppath=D:\hprof-dumps.
Add-xx:+HeapDumponoutofmemoryError-xx:Heapdumppath=D:\hprof-dumps.
Add-xx:+HeapDumponoutofMemoryError-xx:Dumppath=D\hprof-dumps.
Add-xx:+DumpHeaponoutofmemoryError-xx:Heappath=D:\hprof-dump.
Add-xx:+HeapdumponoutofMemory-xx:HeapDumppath=D:\hprof-dumps.
Score 1 of 1
Question:
Which machines can be configured by using the configuration Wizard?
Response:
machine and Windows machine
machine and UNIX machine
RDBMS machine and LDAP machine
stand –alone machine and cluster machine
administration machine and managed machine
Score 1 of 1
Question:
The minimum number of managed servers in a domain:
Response:
1
2
3
0
Score 0 of 1
Question:
You configure a data source with a non XA driver because your (non-Oracle) database does not provide XA drivers.
The data source will sometimes participate in global transactions with an EJB, so as you configure the data source you select “Supports Global Transactions” and One-phase commit.
Why is this configuration wrong?
Response:
"One-Phase Commit" processes this data source last In the global transactions, if the EJB must go last, you cannot use this configuration.
"One-Phase Commit" only allows this data source to participate in global transaction, so you cannot have a global transaction that includes an EJB.
You must choose an XA driver when a data source participates In global transactions.
"One' Phase Commit" always returns "ready" during phase one of the two-phase commit process’ so it is possible you will have heuristic errors in the database.
Score 1 of 1
Question:
During a performance test, a server’s log includes several out of memory error messages. You are using the Administration console.
How can you verify the amount of available heap in the server?
Response:
Click the server’s Debug >Health tab.
Click the server’s Monitoring > Threads tab.
Click the server’s Monitoring >Health tab.
Click the server ‘s Monitoring >performance tab.
Click the server ‘s Debug > Heap tab.
Score 1 of 1
Question:
You are setting up a GridLink Datasource.
What function will help you to seamlessly connect to a dynamic oracle RAC installation
Response:
Single Connection Anonymous Network
Single Client Access name
Simple Connection Access Node
Simple Client access Address Name
Score 0 of 1
Question:
GridLink data sources are designed for use with an Oracle RAC database. By using the Fast Connection Failover (FCF) pattern, GridLink data sources can quickly react when a RAC node goes down.
Which two statements are true?
Response:
The Oracle Notification service is used to notify the data source of changes to RAC nodes.
FCF requires the use and configuration of a database server in the GridLink data source.
You can use any Oracle Thin database driver with a GridLink data source.
FCF is faster because it polls and tests connection, freeing the data source from these tasks.
The reaction is quick, because in using FCF all network timeouts are set very low.
Score 0 of 1
Question:
The startup of a Weblogic Server instance fails with the error message:
java.net.BindExcepttion:Address already in use
Which two methods help identify what is currently listening at the port and the Ip this server is configured to be bound to?
Response:
The pmap command lists all processes running with their associated port member.
The UNIX 1sof command can report information on the process that is listening at a particular IP and port.
Pstat will report detailed runtime statistics on any process currently listening at this IP and port.
The Linux port watching tool port info can raise an alert anytime a process attempts. succeeds, or fails to connect to a specific IP and port. It can also be used to identify if a port is being used by a java process.
netstat, which is available on Windows and Linux/UNIX, can report on the process bound to this IP and port.
Score 1 of 1
Question:
As part of troubleshooting an application, you need to analyze the HTTP session count and the server heap size over the past six hours. You are using the Administration console. You want to view both metrics together and correlate their values.
Which three steps should you take in the Administration console?
Response:
Access the Monitoring Dashboard.
Start the JVM Runtime view.
Drag each metric onto two charts in the same view.
Create a custom view.
Click the application’s Monitoring tab.
Score 1 of 1
Question:
You want to start the managed server calledmanaged1 in “Standby” mode, to keep it as a “hot backup”.
Response:
Only the admin server can start in “standby” mode.
Your domain has an administration port.
The server managed1 must be of a cluster.
There is no such thing as “standby” mode.
Score 1 of 1
Question:
A dynamic cluster is based on:
Response:
Multiple server templates
A domain template
A cluster proxy
One server template
Score 1 of 1
Question:
You are using the configuration Wizard to create a new domain that will consist of a cluster of three managed servers along with an instance of WebLogic server acting as an HTTP proxy to distribute traffic to the cluster.
Which three steps should you perform with the configuration Wizard?
Response:
Specify a proxy port for the administration server.
Assign three servers to a cluster.
Create one cluster .
Install Oracle HTTP server.
Create one coherence server.
Create four managed servers.
Score 1 of 1
Question:
Which two metrics are used to monitor and troubleshoot unicast communication in a cluster?
Response:
Session Replicas
Groups
Master
Backup server
Local Group Leader
Score 1 of 1
Question:
Which statement is true about stopping Node Manager?
Response:
Using the administration console, select the appropriate machine and click stop.The administration server goes into ADMIN mode if it can no longer Communicate with Node Manager.
The managed servers that Nod Manager started go into ADMIN mode if they can no longer communicate with Node Manager.
Using the stopNodeManager.sh script so Node Manager stops gradually.
You may kill the Node Manager process by using operating system commands.
If you stop Node Manager, the managed servers it started will also stop.
Score 1 of 1
Question:
Examine the partial server log entry shown below:
#### <May 19,2013 8:28:01 PM EDT > <warning> <JDBC > <host01> <managed1>
<<WLS kernel >> < > < > < 1369013281005 > <BEA-001129> <Received exception while creating connection for pool -oracleDS1->
Which two statements are true?
Response:
The server’s name is oracleDS1.
The JDBC subsystem generated the message.
The severity level of the message is Critical.
The transaction ID is 001129.
The user’s identity is managed1.
The server’s machine name is host01.
Score 1 of 1
Question:
Which action should you take to automatically back up the domain configuration when anyone Activates a configuration change?
Response:
The administration console , select " Follow Configuration changes" In the Shared preferences for the console.
USE the backup='true' parameter of the ad activate () command In WLST.
In the administration console, select "Configuration Archive Enabled" under the general configuration of the domain.
Enabling automatic domain configuration creates backups of the configuration during server boot not at each activation.
Score 1 of 1
Question:
The name of the boot identity file is:
Response:
password.properties
boot.properties
identity.properties
boot.identity
Score 1 of 1
Question:
To support a growing application workload, you need to scale out an existing (nondynamic) cluster. You power up the new hardware and install WebLogic server.
Which two changes are mandatory for you to make to your domain configuration?
Response:
Add a server to the machine.
Create a new server.
Add the cluster to the machine.
Create a new deployment plan.
Add a server to the cluster.
Create a new machine.
Score 1 of 1
Question:
Each domain has a directory called servers that contains subdirectories for each server in the domain.
When will the managed1 directory be created?
Response:
When the Administration server comes up for the first time
When the managed 1server comes up for the first time
When the managed1 server is defined in the Configuration WIZARD
When the domain is created
Score 1 of 1
Question:
You are carrying out the RDBMS Security Store configuration using the configuration Wizard Which three actions can you perform with the Configuration Wizard during the process?
Response:
Test the connection to a back –end database.
Populate the database tables with external LDAP users.
Execute SQL scripts in WebLogic server’s server /1ib directory.
Create tables in the data store.
Allocate tablespace for the data store.
Score 0 of 1
Question:
You create a new Managed Server in your domain by using the administration console. You give it the listen address of 192.0.2.0 and the listen port of 7100.You save and activate the changes.
You use the domain start script to start the new server. It fails, One of the messages in the window in which you can the script is:
Server failed to bind to any unable port.
You investigate and see that another process is running on 192.0.2.0 on port 7100.You also find many unused ports at that IP address.
Which two statements are true?
Response:
It is an instance of WebLogic Server running at 192.0.2.0:7100. Other processes do not interfere with WebLogic Server.
It cannot be the administration server running at 192.0.2.:7100, because admin servers run on port 7001.
Because this Managed Server has never been started, it does not have a local copy of the configuration. If it did, by using Managed Server Independence, it would be able to switch to an unused port of it s configured port was busy.
It is not an instance of WebLogic Server from this domain running at 192.0.2.0:7100.The administration console does not allow you to create a server at the same listen address and port as one already configuration in the domain.
Changes the port number to an unused one to resolve this issue.
The port number can stay 7100 if this machine has another IP address and the port is unused at that address.
Score 1 of 1
Question:
You are using the Administration console to monitor a resource.
Which three techniques can you use to customize the monitoring output?
Response:
Limit the number of rows displayed.
Store the rows by a specific column.
Combine (add) multiple columns together.
Change the order of the displayed columns.
Views the rows from a specific time range.
Score 1 of 1
Question:
You set up two network channels for server –to-server communication. You want channel x to be used more than channel Y, so you give channel x a higher channel Weight. You want to see if indeed channel X is used more.
You use the administration console and look at both channels under each one’s Monitoring tab. What scenario would best assure you that channel x has an overall higher connection rate?
Response:
Channel X Connections is higher.
Channel X Bytes Received is higher.
Channel X Accept Count is higher.
Channel X Bytes Sent is higher.
Score 1 of 1
Question:
Which of the following is NOT an available authentication provider control flag?
Response:
ALWAYS
SUFFICIENT
OPTIONAL
REQUIRED
REQUISITE
Score 1 of 1
Question:
You need to take a web application offline.
Which three options are supported In WebLogic Server when you stop a running application?
Response:
Terminate HTTP sessions after three minutes .
Allow new requests only through the administration port.
Move HTTP sessions to a database.
Wait for HTTP sessions to time out.
Move in –progress requests to another server in the cluster.
Terminate HTTP sessions immediately.
Score 1 of 1
Question:
Which two statements are true about WebLogic data sources?
Response:
A data source contains a connection pool.
Data sources are targeted to a domain.
Data sources are bound in the JNDI tree of a server.
A domain requires at least one data source.
Data sources are based on the JMS specification.
Score 1 of 1
Question:
You require high availability for HTTP sessions in a web application. In addition, you have the following constraints:
• There is little free memory on the machines hosting the cluster.
• HA must be guaranteed even when multiple machines fall simultaneously.
• You are not allowed to update the production databases schema.
Which is the best session persistence option?
Response:
In-memory replication
File persistence
Database persistence
Whole –server migration
Score 1 of 1
Question:
Which three runtime metrics can you monitor or collect from WebLogic Server applications?
Response:
Number or transaction rollbacks for a web server
Number of instances of an EJB
Number of current sessions for an EJB
Average execution time for a web application URL.
Maximum HTTP session timeout for a web application
Numbers of faults /errors for a web service
Score 1 of 1
Question:
When you shut down a managed server by using the admin console, Node Manager is involved:
Response:
Each time
Never
If the managed server cannot be reached by the admin server
Score 1 of 1
Question:
The Administration Server of a domain falls due to a hardware failure. The hardware is beyond repair.
Before the failure you prepared a “backup admin server”. You go through your planned recovery process and are successful. The Administration Server is now running on different hardware. The managed servers of the domain automatically reconnect to the admin server.
Select the two statements that are true.
Response:
The backup admin server is any one of the running managed servers. You select one of the managed servers, stop it, set its “administration” flag, and restart it as the admin server of the domain.
At the time of the failure ,the backup admin server was running in “Standby” mode on different hardware in the same network.
The backup admin server must be running at the same DNS name or IP address as the original.
Files of deployed applications are available to the backup admin server from the same relative location as they were to the original admin server.
When the admin server failed, you must have shut down and restarted the managed servers, otherwise they could not have reconnected to the failed admin server.
Score 0 of 1
Question:
Which two statements are true about multicast communication within a cluster?
Response:
Multiple cluster can share the same multicast address and port.
Multicast traffic is often limited to a single subnet.
You may disable multicast on individual cluster members.
Multicast can be used for cluster heartbeat messages.
Multicast is used to replicate session state between servers.
Score 1 of 1
Question:
You see a script called start WebLogic.sh(.cmd in Windows) in the root folder of your domain.
What does this script do?
Response:
Starts Node Manager
Calls the startManagedWebLogic.sh script in the domains bin directory
Starts a machine
Calls the startwebLogic.sh script in the domain’s bin directory
Starts a Managed server
Score 1 of 1
Question:
You are responsible for configure a WebLogic domain to support an order processing application. This application will communicate with multiple JDBBC data sources to fulfill each customer order. 
To maintain data integrity across these databases, work will be performed within a global transaction. However, you have learned that one of the data sources in the transaction does not have an XA driver.
Which option should you select on this non-XA data source to ensure that orders are still processed as global transactions?
Response:
One phase commit
Test connection on Reserve
Logging connections on Resource
Pinned to Thread
Ignore Heuristics
Score 1 of 1
Question:
Your server includes an application that users a generic JDBC data source to connect to a database. However, the network connection between the server and the database is not 100%reliable.
Identify two data source attributes that, if set properly can help avoid situations in which the application fails due to a failed JDBC connection.
Response:
Test Connection Mode
Pool Reserve Mode
Statement Cache Type
Test Connections on Reserve
Test Table Name
Score 0 of 1
Question:
An administrate in your organization says you do not need to back up the domain files on a machine which only managed servers run.
Select the best explanation for this statement.
Response:
This Is true because the domain files can be re created with the pack and unpack utilities.
This is true (with an exception) because the domain files can be re-created with the pack and unpack utilities. The exception is for applications that are deployed to the managed server. Those files are not included in the JAR file created by the pack utility. If you back those up manually, then pack and unpack can be used.
This is true (with an exception) because the domain files can be re-created with the pack and unpack utilities. The exception is if your security realm uses the embedded ldap system. Which is not included in the JAR file created by the pack utility.
This is not true. You need to back up the domain files on a machine on which only managed servers run by using operating system commands (such as tar or zip).
Score 1 of 1
Question:
The default context path of the web application that is the administration console is: __________.
Response:
admin
weblogic
em
console
Score 1 of 1
Question:
With LDAP, what does DN stand for?
Response:
Directory Network
Dynamic Name
Distinguished Name
Directory Name
Score 1 of 1
Question:
In-memory session replication copies session data from one clustered instance of WebLogic Server to:
Response:
All instances of WebLogic Server in the Preferred Secondary Group
All other instances of WebLogic Server in the cluster
All instances of WebLogic Server in the same Replication Group
Another instance of WebLogic Server in the cluster
Score 1 of 1
Question:
You zipped up the domain’s config directory on the administration server’s machine before making some major configuration changes. You wait to activate after all the changes have been saved.
After your changes are in, hinges start failing badly. You want to go back to the old configuration.
What is the best course of action?
Response:
1. Stop the administration server.
2. Replace the config directory on the administration server’s machine with your backup.
3. Restart the administration server.
1. Stop the administration server.
2. Extract only the config.xm1 file from the zip file.
3. Overwrite config.xm1 on the administration server’s machine with this extracted file.
4. Restart the administration server.
1. Stop the administration server.
2. Replace the config directory on the administration server’s machine with your backup.
3. Restart the administration server.
4. Stop the managed servers on each machine.
5. Replace the config directory on the machine with your backup.
6. Restart the managed servers on the machine.
Undo the changes you made manually by using the administration console or WLST.
Score 1 of 1
Question:
Before you view JVM performance information in the administration console, you want to request that the JVM do a garbage collection.
How can you do this in the admin console?
Response:
In the Monitoring - Performance tab, click Garbage Collect.
In the Monitoring > Performance tab, click GC.
You cannot do this from the admin console. You must use WLST or a JVM command- line tool.
In the Monitoring > Performance tab, click Dump thread Stacks.
In the Monitoring > Threads tab, click Dump thread Stacks,
Score 1 of 1
Question:
A new machine was given to your department. This machine has two WebLogic server12.1.2 installation, each with different inventories.
Which command or tool do you determine the differences in products installed in each of the inventories?
Response:
ORACLE_HOME/wiserver/bin/compareInventory-sh-oracle-home1 < oracle-home1 location > - oracle-home2 < oracle-home2 location >.
ORACLE _HOME2 < oracle _home2 location >.
None, inventories are used by Oracle databases only.
The Oracle Inventory Viewer utility
Score 0 of 1
Question:
Consider an existing nondynamic cluster that is currently hosting many libraries, applications, and data sources. You need to scale out this cluster to include a new server. You provision the domain on new machines.
What are the two ways to create this new server in the domain configuration?
Response:
Use pack and unpack to copy an existing server in the cluster.
Use the Configuration Wizard to add a new server to the cluster.
Use the Administration Console to clone an existing server in the cluster.
Use the Administration Console to add a new network channel to the cluster.
Score 0 of 1
Question:
Which three tasks can be performed by the Node Manager?
Response:
Define a new server
Automatically restart a failed server.
Host the Node Manager console.
Kill a server process that did not shut down property.
Start a server
Kill a failed application on a server.
Score 0 of 1
Question:
An online store web application is deployed to a WebLogic server cluster. User of the application frequently complain that the information in their shopping cart vanishes before they are able to complete an order. You use the Administration Console to monitor the web application.
Which metric is the most relevant to this problem?
Response:
Average execution time
Cookie domain
High session count
Current session count
Session timeout
Score 0 of 1
Question:
You are creating a domain by using the configuration Wizard. In the wizard, you select to configure Node Manager. Under “Node Manager Type, you select “Manual Node Manager setup”.
What does this mean?
Response:
The configuration Wizard prompts you to change the default Node Manager configuration values.
You must manually copy the Node Manager files generated by the configuration Wizard into Node Manager home.
You are using the configuration Wizard to configure a script –based Node Manager.
You are using the configuration Wizard to configure a Java –based Node Manager.
The configuration Wizard bypasses all Node Manager configuration.
Score 1 of 1
Question:
Consider a domain that includes a dynamic cluster of three servers. Your network administrator requires all servers to bind the specific domain name mycompany.com.
Which Administration console action implements this requirement?
Response:
Update the cluster’s listen address prefix.
Assign each dynamic server a separate machine.
Create multiple server templates for the cluster.
Use a $(macro)in the server templates listen address.
Score 1 of 1
Question:
You are working for a software company that mostly dealt with creating and reusing C++ and.
NET objects. There are many COM (Component Object Model) components that have been created over time that provide standardized functionalities. Recently, platform independence has become a major consideration for your organization and you have deployed WebLogic server12c.But you would like to make use of some of your prebuilt COM objects for request processing. You need an interim solution before implementing web services.
Which artifact within WebLogic server helps you achieve your objective?
Response:
XML Registry
IDL Mapper
Messaging Bridge
jCOM
COM2 Java
Score 1 of 1
Question:
To configure a Node Manager by using the admin console, what resource is selected before you click its Node Manager tab?
Response:
A machine
A cluster
A managed server
The administration server
Score 1 of 1
Question:
Which three statements about patching Web Logic server (WLS) by using Opatch are true?
Response:
Each patch comes with a “read me” file containing installation instructions.
Opatch is a GUI tool and requires the operating system to have a window manager.
You can use Opatch to see which patches are currently applied to WebLogic server.
Opatch requires a JDK to run.
After installing WLS, you download the Opath utility from Oracle support.
Each patch ZIP file comes with the Opatch utility.

Hyderabad Trip - Best Places to visit

 Best Places to Visit  in Hyderabad 1.        1. Golconda Fort Maps Link :   https://www.google.com/maps/dir/Aparna+Serene+Park,+Masj...