bkreynolds48
asked on
find latest files and ftp to another server
I have a script that will ftp all archive log files from one machine to another but need to find just the files that have not been copied over and just ftp them.
I am on AIX 5.3
Here is the script I am using...
#!/bin/ksh
set -xv
########################## ########## ########## ########## ######## script to ftp archive logs.
########################## ########## ########## ########## #######
export ORACLE_BASE=/app/oracle/pr oduct
export ORACLE_ADMIN=/app/oracle/p roduct/adm in
export ORACLE_HOME=/app/oracle/pr oduct/db10 .2
export LD_LIBRARY_PATH=/app/oracl e/product/ db10.2/lib
#
########################## ########## ########## ########## #######
#
cd /oradata/prod/logarch1
echo `date +%m%d%y-%H:%M` > /home/oracle/arch/ftp_arch .log
for next_file in $(find /oradata/prod/logarch1 -name 'prod_arc*.log' -print )
do
ftp -ivn servername>> /home/oracle/arch/ftp_arch .log <<eof
user username password
binary
cd /oradata/prod/logarch1
put $(basename ${next_file})
bye
eof
done
echo `date +%m%d%y-%H:%M` >> /home/oracle/arch/ftp_arch .log
I am on AIX 5.3
Here is the script I am using...
#!/bin/ksh
set -xv
##########################
##########################
export ORACLE_BASE=/app/oracle/pr
export ORACLE_ADMIN=/app/oracle/p
export ORACLE_HOME=/app/oracle/pr
export LD_LIBRARY_PATH=/app/oracl
#
##########################
#
cd /oradata/prod/logarch1
echo `date +%m%d%y-%H:%M` > /home/oracle/arch/ftp_arch
for next_file in $(find /oradata/prod/logarch1 -name 'prod_arc*.log' -print )
do
ftp -ivn servername>> /home/oracle/arch/ftp_arch
user username password
binary
cd /oradata/prod/logarch1
put $(basename ${next_file})
bye
eof
done
echo `date +%m%d%y-%H:%M` >> /home/oracle/arch/ftp_arch
hi, do you need to use FTP or are other programs an option as well? i'm thinking of rsync instead
ASKER
Given the rules where I work can't use rsync
In that case, I'd be doing this in a few steps:
- get remote file list using FTP
- get local file list
- diff remote and local file list (call this to_ftp)
- put files that are in the to_ftp list to remote location
It will require some scripting though...
- get remote file list using FTP
- get local file list
- diff remote and local file list (call this to_ftp)
- put files that are in the to_ftp list to remote location
It will require some scripting though...
ASKER
so how do I script this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks