Wednesday, October 24, 2018

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

No comments:

Post a Comment

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...