Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script info

Status
Not open for further replies.

tech123786

Technical User
Nov 13, 2006
31
US
Hello,
I have a text file with database instance names, each in a line.(Ex: dbinst1
dbinst2
dbinst3)
I need to run some commands on each of these instances after the database startup. I have a separate database startup script. so I just need to add some stuff to the startup script.Here is what I was thinking about.

#!/bin/ksh
#(DB startup commands will come here)
FILE="/usr/local/instfile"
exec 4<$FILE
while read each_line <&4
do
#I will run some commands on that perticular instance.
done
exec 4<&-

Is this right way to read and apply the commands?

Thanks
 
I think a better way is to do this

Code:
while read each_line
do
  echo $each_line     # here is where you should put your commands
done < /usr/local/instfile

try to run this with the echo as a test and then replace the echo with your commands :)

Regards,
Khalid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top