help on understanding this script ( linux)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help on understanding this script ( linux)
# 1  
Old 06-12-2012
help on understanding this script ( linux)

Code:
ORACLE_HOME=/opt/ora10g/oracle/product/10.2.0/db_1;export ORACLE_HOME
PATH=.:$ORACLE_HOME/bin:/usr/bin;export PATH
ORACLE_SID=USUP
PASS=Figomom#0;export PASS

rm /orabkup/USUP/*.Z
if [[ ! -f /tmp/system_reboot.flg ]]
then
   echo $PASS | sqlplus system@USUP @/home/ora10g/crons/scripts/hot.sql
   echo $PASS | sqlplus system@USUP @/home/ora10g/crons/scripts/hotback.sql
fi
#compress /orabkup/USUP/*.dbf
#compress /orabkup/USUP/*.DBF

I am not too sure what is *PASS=Figomom#0;export PASS* and

*if [[ ! -f /tmp/system_reboot.flg ]]*

the above script suppose to do a hot backup . is a user- managed hot backup.
# 2  
Old 06-12-2012
That is setting up a variable for the oracle password.
if there does not exist that reboot file, you will run sqlplus with those hot.sql and hotback.sql scripts..
This User Gave Thanks to Leion For This Post:
# 3  
Old 06-12-2012
Code:
PASS=Figomom#0;export PASS

is password that is getting used to connect to database. Once you set the password you need to export it as environment variable. So whenever you need you can use it.

Code:
if [[ ! -f /tmp/system_reboot.flg ]]

is checking for system_reboot.flg is not an ordinary file, if conditions satisfies then it will do the remaining stuffs inside if condition.
This User Gave Thanks to donadarsh For This Post:
# 4  
Old 06-12-2012
Quote:
Originally Posted by donadarsh
Code:
PASS=Figomom#0;export PASS

is password that is getting used to connect to database. Once you set the password you need to export it as environment variable. So whenever you need you can use it.

Code:
if [[ ! -f /tmp/system_reboot.flg ]]

is checking for system_reboot.flg is not an ordinary file, if conditions satisfies then it will do the remaining stuffs inside if condition.
you mean there are some sort of a script inside system_reboot.flg?

---------- Post updated at 01:58 AM ---------- Previous update was at 01:55 AM ----------

Quote:
Originally Posted by Leion
That is setting up a variable for the oracle password.
if there does not exist that reboot file, you will run sqlplus with those hot.sql and hotback.sql scripts..
you mean if there is no password stated it will reboot the system_reboot.flg? and execute the .sql ?Smilie
# 5  
Old 06-12-2012
The system_reboot.flg should be a flag file and not a script..

this is what your script is doing:
first it sets up some variables, including the PASS, which is holding the password to log into oracle.

after setting up the variables, it removes/deletes all the files that has a file extension of Z in directory /orabkup/USUP/

Then it checks for the non-existence of the /tmp/system_reboot.flg file.
if this is indeed not present, it will run the commands found in the oracle sql files.(hotback up as you mentioned)

I hope this is clear..

Quote:
Originally Posted by redologger
you mean there are some sort of a script inside system_reboot.flg?

---------- Post updated at 01:58 AM ---------- Previous update was at 01:55 AM ----------



you mean if there is no password stated it will reboot the system_reboot.flg? and execute the .sql ?Smilie
This User Gave Thanks to Leion For This Post:
# 6  
Old 06-12-2012
Quote:
Originally Posted by Leion
The system_reboot.flg should be a flag file and not a script..

this is what your script is doing:
first it sets up some variables, including the PASS, which is holding the password to log into oracle.

after setting up the variables, it removes/deletes all the files that has a file extension of Z in directory /orabkup/USUP/

Then it checks for the non-existence of the /tmp/system_reboot.flg file.
if this is indeed not present, it will run the commands found in the oracle sql files.(hotback up as you mentioned)

I hope this is clear..
YEs is clearer now.

Check the existence of the flat file system_reboot.flg. From the name , i think is to check whether the last reboot indeed have remove / change the flag? Or is it to check for system reboot. To make sure it is not going to reboot while doing the backing?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shall script use and understanding

Below script is called as Reducer, I am not sure how it work, can some expert explain me what this script does as i am a beginner. inputfile: hi hi how are are you code: #!/bin/bash lastkey=""; -- what does this mean, because i saw in debug mode it is taking value as hi count=0;... (13 Replies)
Discussion started by: mirwasim
13 Replies

2. Shell Programming and Scripting

Help understanding the script

Could someone please help me in understanding the code below: #!/usr/bin/ksh Month=`date|cut -c5-7` Day=`date|cut -c9-10` Year=`date|cut -c27-28` Rom2Jul() { case $Month in Feb) Day=$(( $Day+31 ));; Mar) Day=$((... (27 Replies)
Discussion started by: hasn318
27 Replies

3. Shell Programming and Scripting

Help--understanding the script

Hi, New to this forum, as well as to unix scripting..need help to understand below script ... sendNotice_sp() { ATTACH=${LNXLOG:-} if ; then if ; then mail -s "$ERR_MSG" $ERR_EMAIL_TO < $ATTACH fi else mail -s "$ERR_MSG" $ERR_EMAIL_TO < /dev/null fi } afaik this is sm kind of... (6 Replies)
Discussion started by: gnnsprapa
6 Replies

4. Ubuntu

Suggest books for understanding Ubuntu Linux

recommend books to understand ubuntu ...... (14 Replies)
Discussion started by: vyom
14 Replies

5. Shell Programming and Scripting

Help understanding the script

Hi Guys, I am new to scripting , I am trying to rebuild a script based on an old script. Can someone help me figure out what the script is doing? This is only a part of the script. I am looking to interpret these two points in the scripts:- 1) test=`echo $?` while I do not... (3 Replies)
Discussion started by: rajsan
3 Replies

6. Programming

Understanding Linux Kernel

Hi, I have started reading about Linux kernel. The books also explains about the source code here and there. I found a file named head.s in the source which i am not able to understand, it looks like some assembly language. Can anyone confirm this, so that can start looking for assemble... (3 Replies)
Discussion started by: kumaran_5555
3 Replies

7. UNIX for Dummies Questions & Answers

help with understanding script

i am trying to understand this script example. the text does not explain it. can someone tell me briefly what each of the functions do. any help will be appreciated. #!/bin/bash killtree() { local _pid=$1 local _sig=${2-TERM} for _child in $(ps -o pid --no-headers --ppid... (1 Reply)
Discussion started by: iluvsushi
1 Replies

8. UNIX for Dummies Questions & Answers

Really understanding Linux/Unix-Derivatives

Hi I've been using Linux (Ubuntu) specifically for about 5 years now and been dabbling with nix for a couple more. I really am worried that with the way distro's are going and package management that i'm starting to loose touch with compiling applications and really understanding how they work.... (4 Replies)
Discussion started by: shitson
4 Replies

9. Shell Programming and Scripting

Need help for understanding of script

# sub: find block (in cols), return line-numbers (begin-end) or 0 if notfound sub findb{ my ($exp1,$col1,$exp2,$col2)= @_; # $exp = expression to find, $col - column to search in my $cnt=0; my ($val1,$val2); my ($beg,$end); for($cnt=1;$cnt<=65536;$cnt++){ $val1 =... (3 Replies)
Discussion started by: suvenduperl
3 Replies

10. UNIX for Dummies Questions & Answers

Understanding UNIX/Linux

Hello: I'm a totally newbie here. My company has UNIX. My development team would like me to learn UNIX and shell scripting. I've worked with Linux in the past, very briefly. I have Ubuntu installed on my laptop. I was wondering whether or not the shell scripting for Linux is the same... (0 Replies)
Discussion started by: hbradshaw
0 Replies
Login or Register to Ask a Question