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

ftp using mget based on time stamp

Reply to Message Icon

Original Message
Name: svvidyanath
Date: December 13, 2004 at 20:15:16 Pacific
Subject: ftp using mget based on time stamp
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


Report Offensive Message For Removal


Response Number 1
Name: cbailey33
Date: December 13, 2004 at 23:31:58 Pacific
Subject: ftp using mget based on time stamp
Reply: (edit)

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/* ../


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: ftp using mget based on time stamp 

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge