![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
Thanks, you got the point still learning but I'll get there.
Cheers once again |
|||
| Google The UNIX and Linux Forums |