Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Need to get out of 2 variables in scripts Post 303037119 by amar1208 on Wednesday 24th of July 2019 06:48:22 AM
Old 07-24-2019
Thank Rudic, that space issue is resolved, i have other issue now

Note:

CURRENT_PRIM is on node 1
CURRENT_COB is on node 2
here i am trying to get values into below variable from node 1 and node 2
PRIMARY_CONF from node 1 and STANDBY_CONF from node 2

i updated with script
Code:
set -x --to check the issue, so here i can see it is not taking values in STANDBY_CONF from if condition from scrip

below i got issue
Code:
+ '[' 'PRIMARY ' = 'PRIMARY ' -a ' ' = 'PRIMARY ' ']'
+ echo 'There is Eroro'
There is Eroro
+ exit


======================
please help.....

below is script

Code:
CURRENT_PRIM=ABC
CURRENT_COB=XYX
PRIMARY_CONF=`srvctl config database -d $CURRENT_PRIM | awk -F: '/^Database role/ {match ($0, /[A-Za-z_]*PRIMARY[A-Za-z_]*/); print substr ($0, RSTART, RLENGTH)}'`
echo $PRIMARY_CONF
#######CURRENT_COB  this DB lies node 2 and in node 1 is CURRENT_PRIM DB is there 
echo "Enter the COB  Hostname"
read "COB_HOST"
echo
echo "Connenting to COB HOST $COB_HOST"
ssh $COB_HOST << EOF
STANDBY_CONF=`srvctl config database -d $CURRENT_COB | awk -F: '/^Database role/ {match ($0, /[A-Za-z_]*PRIMARY[A-Za-z_]*/); print substr ($0, RSTART, RLENGTH)}'`
echo $STANDBY_CONF
#EOF

if  [ "$PRIMARY_CONF " = "PRIMARY " -a  "$STANDBY_CONF " = "PRIMARY " ]; then
echo "Modified the DB $CURRENT_PRIM to $PRIMARY_CONF in cluster level but it will change after Datbase bounce During the  SWITCHOVER  Activty"echo "Modified the DB $CURRENT_COB to  $STANDBY_CONF in cluster level but it will change after Datbase bounce During the  SWITCHOVER  Activty"
else
echo "There is Eroro"
exit
fi


Last edited by Don Cragun; 07-24-2019 at 09:38 AM.. Reason: Add CODE and ICODE tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

executing variables in ksh scripts?

In a ksh script on an AIX box running a jillion oracle database processes, I'm setting a variable to one of two possible arguments, depending on cmd line arguments. FINDIT="ps -ef | grep oracle | grep DBexport | grep rshrc" -or- FINDIT="ps -ef | grep oracle | grep prod | grep runback" I... (3 Replies)
Discussion started by: zedmelon
3 Replies

2. UNIX for Dummies Questions & Answers

Variables in scripts

Just a quick question. If I have a script that calls another script while running, is it possible for the second script to reference a variable in the first script and if so, how. Is it scriptname.sh:$VARIABLE for a global variable and can you do scriptname.sh:function $VARIABLE or am I off my... (1 Reply)
Discussion started by: kirkm76
1 Replies

3. Shell Programming and Scripting

How to access variables across scripts

Hi All, I have declared a variable in script1 and assign a value for it. In script2 i'll call script1 and then I want the value of variables set in script1. I have tried with export, but in vain. How can I achive this? Below is the two scripts. --script1 #!/usr/bin/ksh echo $1... (1 Reply)
Discussion started by: javaDev
1 Replies

4. UNIX for Dummies Questions & Answers

Passing variables between scripts...

Hey all, I'm wondering how you pass variable's that are defined in one script to another script that's been called by that first script..... Best regards, Jaz (1 Reply)
Discussion started by: Jazmania
1 Replies

5. Shell Programming and Scripting

Passing variables between scripts

Hi all. I need to pass a value from a script that runs in a sub-shell, back into the calling shell like below (or into script 2 directly): outer_script export param=value1 script1 $param (in script1: export param=value2) script2 $param ($param is now value1, not value2... (4 Replies)
Discussion started by: bbergstrom74
4 Replies

6. Shell Programming and Scripting

Scope of variables between scripts

Friends, I am using ksh under SunoS. This is what I have In file1.sh NOW=$(date +"%b-%d-%y") LOGFILE="./log-$NOW.log" I will be using this file through file1.sh as log file. I have another script file2.sh which is being called inside my file1.sh. I would like to use the same log... (6 Replies)
Discussion started by: dahlia84
6 Replies

7. UNIX for Advanced & Expert Users

How to make the variables of one script available for the other scripts?

Hello Everyone, I want to know how can we make the variables of one script available for the other script? for example i have three scripts variable_availability.sh,first.sh,second.sh and a file containing variables called common ---------------------------------- cat variable_availability.sh... (2 Replies)
Discussion started by: Kesavan
2 Replies

8. Shell Programming and Scripting

How to declare variables once and reuse them in other scripts?

Hello everyone. I'm trying to create a conf file with variables that my other scripts will use. I have several scripts that use the same variables, and since I don't know how to read them from an external file, i define them in each script (and then if i want to change one's value i need to... (4 Replies)
Discussion started by: moshe88
4 Replies

9. Shell Programming and Scripting

Passing variables between sub-scripts

I have written a program for some data analysis. It is gettin long. I would like to restructure it so that i can have a master file which controls multiple subscripts in order to make it easier to understand. I need to be able to define variables in the master script which are used by all three... (2 Replies)
Discussion started by: carlr
2 Replies

10. Shell Programming and Scripting

How to pass variables between scripts?

Hello, I have two bash scripts like the following: script 1: #!/bin/bash var=WORLD bash path/to/second/script/script2.bash script 2: #!/bin/bash echo "HELLO $var" I expected the output to be "HELLO WORLD" but instead, I get "HELLO". I understand that when I envoke another bash... (2 Replies)
Discussion started by: jl487
2 Replies
load(8) 						      System Manager's Manual							   load(8)

Name
       load - down-line load software to a target node

Syntax
       /etc/load [ node ]

Description
       The command loads software to an unattended target node.  The target node is loaded by the host that executes the command.

       The  command requires the identification of the service circuit over which the load is performed, the Ethernet hardware address of the tar-
       get node, and the service password needed to gain access to the target.	This information is included in the nodes database entry  for  the
       target  node.   A node entry is defined with the command.  For further information, see The node is the name or address of the target node.
       A node name consists of from one to six alphanumeric characters.  For single networks,  a  node	address  consists  of  a  decimal  integer
       (1-1023).   For	multiple  networks,  a	node  address  consist of two decimal integers (n.n), where the first indicates the network number
       (1-63), and the second indicates the node address (1-1023).

Options
       -p   Uses the specified service and password (next arguments) in accessing the target node.  You can omit a target node's service and pass-
	    word from the nodes database for security reasons, but you must then specify the service and password in the command line by using the
	    option.

Examples
       # /etc/load bangor -p 130fe
       This command causes node to be loaded by the ULTRIX host node executing the command.  The ULTRIX host uses the load files specified in  the
       nodes database entry for node to perform the load.

See Also
       addnode(8), ccr(8), getnode(8), mop_mom(8), remnode(8), trigger(8)
       Guide to Local Area Transport Servers

																	   load(8)
All times are GMT -4. The time now is 08:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy