Sponsored Content
Top Forums Shell Programming and Scripting Creating a file inside a script Post 302068820 by vino on Tuesday 21st of March 2006 06:40:45 AM
Old 03-21-2006
Quote:
Originally Posted by sendhilmani
This is the script:


DEFINE_ENV_VAR()
{
. /usr/dacscan/bin/DSCANenv
LOG=/dacscan/words/shdsl_mrp_verify_eqpt
DEFINE_ENV_VAR()
{
. /usr/dacscan/bin/DSCANenv
LOG=/dacscan/words/shdsl_mrp_verify_eqpt
ORACLE_HOME=/opt/oracle
ORACLE_SID=S
export ORACLE_HOME
export ORACLE_SID
TDATE=`date "+%m%d%y"$$`
DEFINE_ENV_VAR()
{
. /usr/dacscan/bin/DSCANenv
LOG=/dacscan/words/shdsl_mrp_verify_eqpt
ORACLE_HOME=/opt/oracle
ORACLE_SID=S
export ORACLE_HOME
export ORACLE_SID
TDATE=`date "+%m%d%y"$$`
LOGFILE=$log.$TDATE
}
I assume your script starts like this and not as shown above.

Code:
DEFINE_ENV_VAR()
{
. /usr/dacscan/bin/DSCANenv
LOG=/dacscan/words/shdsl_mrp_verify_eqpt
ORACLE_HOME=/opt/oracle
ORACLE_SID=S
export ORACLE_HOME
export ORACLE_SID
TDATE=`date "+%m%d%y"$$`
LOGFILE=$log.$TDATE
}
user=`echo $LOGNAME`
if [ $user != dacscan ]
then
echo "Please login as 'dacscan' to run this tool" > $LOGFILE
exit 1
else
echo "U r a valid user and now the check for single instance is going on" | tee -a $LOGFILE
echo "U r user validation is successful"
fi

if [ ! -f /tmp/shdsl_mrp_verify_eqpt.tmp ]
then
ps -ef | grep shdsl_mrp_verify_eqpt.sh | awk '{print $8}' > /tmp/shdsl_mrp_verify_eqpt.tmp
else
echo "Another instance of the tool is already running. Only one instance of the tool can be run at a given point of time" | tee -a $LOGFILE
echo "Cannot run the tool as already another instance of the tool is running"
exit
fi

Create_Proc()
{
create=`sqlplus -s dacscan/mnc <<!
set serveroutput on;
start shdsl_mrp_verify_eqpt.sql;
!`
if [[ $(echo $create | grep "ORA-") != "" ]]
then
echo "Error occured while creating the procedure. Check the Activity log file for further details" | tee -a $LOGFILE
rm /tmp/shdsl_mrp_verify_eqpt.tmp
exit 1
fi
}

Run_Proc()
{
status=`sqlplus -s dacscan/mnc <<!
set serveroutput on;
spool shdsl_mrp_verify_eqpt;
exec EQPT_VERIFY;
spool off;
!`
if (($?!=0))
then
echo "Unable to connect to oracle for running/executing the procedure" |tee -a $LOGFILE
rm /tmp/shdsl_mrp_verify_eqpt.tmp
exit 1
elif [[ $(echo $status | grep "ORA-") != "" ]]
then
echo "Error occured while executing the procedure" | tee -a $LOGFILE
rm /tmp/shdsl_mrp_verify_eqpt.tmp
exit 1
fi
}
rm /tmp/shdsl_mrp_verify_eqpt.tmp
DEFINE_ENV_VAR
Create_Proc
Run_Proc

Please put your code within code tags for easy reading.

Last edited by vino; 03-21-2006 at 08:09 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to find Script file location inside script

I have to find out the file system location of the script file inside script. for example a script "abc.sh" placed anywhere in the file system when executed shold tell by itself the location of it. example #pwd / #./abc this is / #cd /root #./abc this is /root #cd / #/root/abc this... (10 Replies)
Discussion started by: asami
10 Replies

2. Shell Programming and Scripting

script to check for a condition inside a file

Hi I am writing a script file which sends the log files along with their size in a folder named log to a file called temp.log using the following cmd: ls -st 190_GSTV_HUX_003QISCGSK026** >> /home/user/temp.log the temp.log looks like this: 16 190_GSTV_HUX_003QISCGSK026_message070321.log ... (11 Replies)
Discussion started by: kiran1112
11 Replies

3. Shell Programming and Scripting

(Urgent):Creating flat file using sql script and sqlplus from UNIX Shell Script

Hi, I need help urgently for following issue. Pls help me to resolve this issue. I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql) I given... (6 Replies)
Discussion started by: praka
6 Replies

4. Shell Programming and Scripting

KSH - help needed for creating a script to generate xml file from text file

Dear Members, I have a table in Oracle DB and one of its column name is INFO which has data in text format which we need to fetch in a script and create an xml file of a new table from the input. The contents of a single cell of INFO column is like: Area:app - aam Clean Up Criteria:... (0 Replies)
Discussion started by: Yoodit
0 Replies

5. Shell Programming and Scripting

Need help in creating file restoration script from a backup script.

Hi all i am struggling in creating a restore of env files while doing applications clone. the first file i created for copying the important configurations file which is running perfect now for reverting the changes i mean when i am restoring these files to its original places i have to do... (7 Replies)
Discussion started by: javeedkaleem
7 Replies

6. UNIX for Dummies Questions & Answers

File operations are failing inside the script

Hi, does any one know the environmental parameter that I have to set so as to make sure the file operations run properly within the script. right now when I am doing a cat from within the script nothing happens, same is the case when I do a grep. when I am doing awk '{print $0 }' its printing... (1 Reply)
Discussion started by: ahmedwaseem2000
1 Replies

7. Shell Programming and Scripting

Creating loops inside a file and extracting and loading data

Help needed (1 Reply)
Discussion started by: Chand Shrestha
1 Replies

8. Shell Programming and Scripting

Running .sh file inside a shell script

Hello, You might help a newbie like me, I am trying to run a .sh inside my shell script. After running that I need to execute below commands. Here's how my scripts looks like. Hope you can help: #!/bin/sh cd $ORACLE_HOME/owb/bin/unix ./OMBPlus.sh ---> goes to OMB+> directory cd... (10 Replies)
Discussion started by: aderamos12
10 Replies

9. Shell Programming and Scripting

Script to validate dates inside a file

Hi All, Looking forward a script with below requirement.Please let me know if any pointers. - there is a file which contains date - script will go inside the file and validate date is T-1 and for Friday T-3 - Send email with status -Shell is Ksh (2 Replies)
Discussion started by: dattatraya
2 Replies

10. Shell Programming and Scripting

Creating new file inside a for loop

Hi, I have list of files present in a folder. I want to search for a particular keyword sequentially and create a file which will be later used by some other program. Input files: $ ls a.dsx b.dsx c.dsx Dataline_.txt Dataline.txt loop.sh $ cat *.dsx help tyiis global for i in... (4 Replies)
Discussion started by: mac4rfree
4 Replies
OCF_HEARTBEAT_ORALSN(7) 					OCF resource agents					   OCF_HEARTBEAT_ORALSN(7)

NAME
ocf_heartbeat_oralsnr - Manages an Oracle TNS listener SYNOPSIS
oralsnr [start | stop | status | monitor | meta-data | validate-all] DESCRIPTION
Resource script for Oracle Listener. It manages an Oracle Listener instance as an HA resource. SUPPORTED PARAMETERS
sid The Oracle SID (aka ORACLE_SID). Necessary for the monitor op, i.e. to do tnsping SID. (unique, required, string, no default) home The Oracle home directory (aka ORACLE_HOME). If not specified, then the SID should be listed in /etc/oratab. (optional, string, no default) user Run the listener as this user. (optional, string, no default) listener Listener instance to be started (as defined in listener.ora). Defaults to LISTENER. (unique, optional, string, no default) SUPPORTED ACTIONS
This resource agent supports the following actions (operations): start Starts the resource. Suggested minimum timeout: 120. stop Stops the resource. Suggested minimum timeout: 120. status Performs a status check. Suggested minimum timeout: 60. monitor Performs a detailed status check. Suggested minimum timeout: 30. Suggested interval: 10. validate-all Performs a validation of the resource configuration. Suggested minimum timeout: 5. meta-data Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5. methods Suggested minimum timeout: 5. EXAMPLE
The following is an example configuration for a oralsnr resource using the crm(8) shell: primitive p_oralsnr ocf:heartbeat:oralsnr params sid=string op monitor depth="0" timeout="30" interval="10" SEE ALSO
http://www.linux-ha.org/wiki/oralsnr_(resource_agent) AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors) resource-agents UNKNOWN 03/09/2014 OCF_HEARTBEAT_ORALSN(7)
All times are GMT -4. The time now is 12:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy