Computing.Net > Forums > Unix > ftp using mget based on time stamp

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

ftp using mget based on time stamp

Reply to Message Icon

Name: svvidyanath
Date: December 13, 2004 at 20:15:16 Pacific
OS: solaris 9
CPU/Ram: 4gb
Comment:

Hi ,
we have a standby database and everyday in the night at 1 a.m we have to ftp the archive log files from the production server to the standby server and we do the same at 6 a.m in the morning also. now i am trying a write a shell script and run it at 6 a.mwhich will ftp only those files which are created between 1.am to 6 a.m. i really don't know how to catch the files based on their timestamp.any help will be highly appreciated. following is the script i wrote to ftp the files from prod to standby.
cd /ora02/oracle/arch

ftp -i -n orctest <<EOF

user oratest pword

bin

cd /ora03/oracle/arch

ls

mget *.arc

bye

EOF

regards,
vidyanath



Sponsored Link
Ads by Google

Response Number 1
Name: cbailey33
Date: December 13, 2004 at 23:31:58 Pacific
Reply:

There are a few programs out that you can use to do this.
I found that a script worked best for me. This may help:

#!/bin/ksh

# Change perms on this script to 700
# to avoid compromising the password
# The line below starts at echo and ends at macdef
echo "machine orctest login oratest password pword macdef
init
lcd /ora02/oracle/arch/logtmp
cd /ora03/oracle/arch
bin
mget *.arc
quit
" > $HOME/.netrc
chmod 600 $HOME/.netrc
ftp -i orctest
sleep 5

# The line below starts at echo and ends at macdef
echo "machine orctest login oratest password pword macdef
init
cd /ora03/oracle/arch" > $HOME/.netrc
cd /ora02/oracle/arch/logtmp
for i in *.arc
do
j=$i.`date +%m%d%y`
echo "rename $i $j" >> $HOME/.netrc
done
echo "quit
" >> $HOME/.netrc
chmod 600 $HOME/.netrc
ftp orctest
sleep 5
mv /ora02/oracle/arch/logtmp/* ../


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: ftp using mget based on time stamp

renaming files based on date arguments www.computing.net/answers/unix/renaming-files-based-on-date-arguments/2499.html

Replace based on position www.computing.net/answers/unix/replace-based-on-position/7230.html

renaming a file based on systm date www.computing.net/answers/unix/renaming-a-file-based-on-systm-date/4875.html