The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script to search for text in a file and copy file imeadows UNIX for Dummies Questions & Answers 9 3 Weeks Ago 06:12 PM
Script to capture new lines in a file and copy it to new file fara_aris Shell Programming and Scripting 0 05-27-2008 07:11 PM
Copy File JuergenW UNIX for Dummies Questions & Answers 2 09-09-2002 05:17 AM
using C to copy a file ... abdul High Level Programming 1 09-11-2001 05:36 AM
% File Copy Enda Martin UNIX for Dummies Questions & Answers 2 08-30-2001 03:26 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-10-2003
Registered User
 

Join Date: Oct 2003
Posts: 7
copy last file

hi,

I have a script which export a database evernight in a directory.

The script alos ftpies the files in the directory to another machine.

Problem is I am copying/ftping everything in the directory. This directory will grow overtime so I want to know I ftp last export in directory and not everything as is doen currently.


Thanks
Forum Sponsor
  #2  
Old 10-10-2003
Registered User
 

Join Date: Jan 2002
Location: Florida
Posts: 84
This makes no sense to me. You should know what file you are exporting to so you should only ftp that file. Or you should be cleaning up at the end of ftping the file so you aren't sending more files. You should not be putting this in a directory that will have other files. You should be either setting up your file name so it is special for each day (and ftping only that one) or putting it in such a place or in such a way that it overwrites yesterday export and you still only have one file to send.

Please give more info on your set up or incorporate the suggestions given. Post OS and version and DB and version.
  #3  
Old 10-10-2003
oombera's Avatar
Registered User
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
If it's not too, too big, why don't you post your script in here? Or at least the part of your script which copies the file to the other directory and then ftp's it to the other machine...

Like thehoghunter is suggesting, it sounds like you may have a problem with the logic in your code.
  #4  
Old 10-10-2003
Registered User
 

Join Date: Oct 2003
Posts: 7
Below is the script,

Cheers


# Set enivironment variables

ORAENV_ASK=NO
ORACLE_SID=cidw1
DATESTAMP="`date +'%d%m%y%H%M'`"
PATH=/usr/dt/bin:/usr/bin:/usr/ccs/bin:/usr/ccs/lib:/usr/ucb:/etc:/usr/sbin:/usr/local/bin:/u001/oracle/product/817/bin:.
LOGDIR=/u001/home/oracle/test/dump
LOGFILE=/u001/home/oracle/export_ftp.log
SSH=/usr/local/bin/ssh

export PATH LOGFILE DATESTAMP BASE SSH ORACLE_SID EXPORT_DIR

perform_export_wiadmin()
{
cd $LOGDIR
rm test*
exp / file=test.$DATESTAMP.dmp log=test.$DATESTAMP.log owner=wi_admin >> $LOGFILE

if [ `cat $LOGFILE | grep -i "Export terminated successfully without warnings" | wc -l` = 0 ]
then
echo "####################################"
echo "** Export of WI_ADMIN Schema successful **"
echo "Scriptname:" $0
echo "Started:"$START "Completed:" `date`
echo "####################################"
# exit 0
else
echo "####################################"
echo "** Export of WI_ADMIN unsuccessful **"
echo "Scriptname:" $0
echo "Started:" $START "Completed:" `date`
echo "####################################"
exit 1
fi
}

perform_ftp()
{
cd /u001/home/oracle/test/
ftp -inv inditf2 <<EOF
user oracle robo3cop0
bin
cd /u001/home/oracle/test/dump/
mget test*.*
bye
EOF
}

main()
{
perform_export_wiadmin
perform_ftp
}
main
#exit 0
  #5  
Old 10-10-2003
Registered User
 

Join Date: Sep 2003
Posts: 25
Hi,

I might be missing the point of the question but can't you just do

get test.$DATESTAMP.dmp

instead of

mget test*.*

Matt.
  #6  
Old 10-13-2003
Registered User
 

Join Date: Oct 2003
Posts: 7
Thanks, you got the point still learning but I'll get there.

Cheers once again
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:51 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0