Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

#!/bin/bash # Author: Balraj Sanhotra # Description: Script to compare different property files for given stacks under /etc/araxid/ice and S3 s3://verato-configuration/.... # Version 1.0.0 # Date: 10/09/2017 NODE=$1 STACK_1=$2 STACK_2=$3 S3_FILEPA

#!/bin/bash
# Author:       Balraj Sanhotra
# Description:  Script to compare different property files for given stacks under /etc/araxid/ice and S3 s3://verato-configuration/....
# Version 1.0.0
# Date: 10/09/2017

NODE=$1
STACK_1=$2
STACK_2=$3
S3_FILEPATH=s3://verato-configuration/
LOCATION=/etc/araxid/ice/
LOCAl_COPY_S3=/data/compare-file/
domain=verato.int

#property_file=("dao.properties" "db.properties" "ir-core-client.properties" "link-core-client.properties" "link.properties" "mts.properties" "normalization-client.properties" "notification-core-client.properties" "notification-core.properties" "service.properties" "solr-cluster.properties" "match-ws-client.properties")

RED_FONT='\033[0;31m'
GREEN_FONT='\033[0;32m'
YELLOW_FONT='\033[1;35m'
NO_FONT='\033[0m'

echo "============================== COMPARING PROPERTY FILES ON /etc/araxid/ice on ${NODE} for the given stacks============================== "
echo "Node      : ${NODE} "
echo "Stack 1   : ${STACK_1}"
echo "Stack 2   : ${STACK_2}"

#Listing all the property files under /etc/araxid/ice for given a given node
property_files=("$(ssh ${NODE}.${STACK_1}.verato.int ls /etc/araxid/ice/)")
property_array=$(echo $property_files | tr " " "\n")
echo -e "The property files avaibale on ${NODE}.${STACK_1}.${domain} are : \n${RED_FONT}${property_array}${NO_FONT} "
echo "------------------------------------------------------------------------------------------------------"

LIST_MISSING_FILE=$(diff <(ssh ${NODE}.${STACK_1}.${domain} "ls ${LOCATION}") <(ssh ${NODE}.${STACK_2}.${domain} "ls ${LOCATION}"))
if [ -z $LIST_MISSING_FILE ]; then
  echo -e " The list of the property files under $STACK_1 and $STACK_2 are ${GREEN_FONT} IDENTICAL ${NO_FONT} "
else
  echo -e " The property files that is missing in either $STACK_1 or $STACK_2 are ${RED_FONT}${LIST_MISSING_FILE}${NO_FONT} "
fi

echo "------------------------------------------------------------------------------------------------------"

for file in ${property_array[@]};do
COMPARE_FILE=$(diff <(ssh ${NODE}.${STACK_1}.verato.int "cat ${LOCATION}"\"$file\""") <(ssh ${NODE}.${STACK_2}.verato.int "cat ${LOCATION}"\"$file\"""))
#echo "\"$file\""
if [ -z $COMPARE_FILE ]; then
  echo -e "Differences in the property file ${YELLOW_FONT}${file}${NO_FONT} are: ${GREEN_FONT}NONE${NO_FONT}"
  echo "------------------------------------------------------------------------------------------------------"
else
  echo -e "Differences in the property file ${YELLOW_FONT}${file}${NO_FONT} are: ${RED_FONT}${COMPARE_FILE}${NO_FONT}"
  echo "------------------------------------------------------------------------------------------------------"
fi
done

echo "============================== COMPARING PROPERTY FILE FROM S3 BUCKET ================================"
echo "S3 file path for ${STACK_1} : ${S3_FILEPATH}${STACK_1}"
echo "S3 file path for ${STACK_2} : ${S3_FILEPATH}${STACK_2}"

#Downloading the property files from S3 to local chef provisioner
COPY_FILE_STACK1=$(sudo aws s3 cp "${S3_FILEPATH}${STACK_1}" "${LOCAl_COPY_S3}${STACK_1}" --quiet --recursive --sse=AES256)
if [ $? -ne 0 ]; then
  echo "The Download of S3 files failed"
  exit 1
else
  echo "${COPY_FILE_STACK1}"
fi

COPY_FILE_STACK2=$(sudo aws s3 cp "${S3_FILEPATH}${STACK_2}" "${LOCAl_COPY_S3}${STACK_2}" --quiet --recursive --sse=AES256)
if [ $? -ne 0 ]; then
  echo "The Download of S3 files failed"
  exit 1
else
  echo "${COPY_FILE_STACK2}"
fi

#Comparing the S3 property files for the given stacks
S3_PROPERTIES=$(diff "${LOCAl_COPY_S3}${STACK_1}" "${LOCAl_COPY_S3}${STACK_2}")
if [ -z $S3_PROPERTIES ]; then
  echo -e "Differences between the S3 property files of $STACK_1 and $STACK_2 are: ${GREEN_FONT}NONE${NO_FONT}"
else
  echo -e "Differences between S3 property files of $STACK_1 and $STACK_2 are: ${RED_FONT}${S3_PROPERTIES}${NO_FONT}"
fi

#Cleaning the folder After comparing the files from S3 bucket
echo "Cleaning up the S3 properties that are locally downloaded on provisioner in /data/compare-file/"
cd /data/compare-file/ || exit
sudo rm -rf "${STACK_1}/"

cd /data/compare-file/ || exit
sudo rm -rf "${STACK_2}/"

Execute Bash Shell Online

echo hello
echo "hello world"
echo "bye"

ghgfh

# Hello World Program in Bash Shell

echo "Hello World!"

Execute Bash Shell Online

# Hello World Program in Bash Shell
#!/bin/bash
echo "Hi"

test

# Hello World Program in Bash Shell

echo "Hello World!"

Amudhu

# Hello World Program in Bash Shell

echo "Hello World!"

test.txt

vi test.txt

test1

# Hello World Program in Bash Shell
#!/bin/bash
#definesource='/relidfilestorage/YBL_DESTINATION/'
deinfpath='/home/appadmin'
outdir='/home/appadmin/script/test_res'
cd $deinfpath/test1
read -t30 -n1 -r -p 'Press any key in the next five seconds...' key
#filename='*.xls'
#echo $filename
#sourcedirs=$deinfpath"/test1 /test2"
read -t30 -n1 -r -p 'Press any key in the next five seconds...' key
#echo $sourcedirs
for d in home/appadmin/{test1,test2}/
do
echo $d
read -t30 -n1 -r -p 'Press any key in the next five seconds...' key
if [  -d $d ]
then
cd $d
cp -rf *.* '/home/appadmin/script/test_res'

read -t30 -n1 -r -p 'Press any key in the next five seconds...' key

echo "Hello World!"

Auto

# Hello World Program in Bash Shell

echo "Hello World!"
cd

cd /
ls
pwd

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.