QUESTION: script for synchronizing directories
- From: "BD" <bobby_dread@xxxxxxxxxxx>
- Date: 28 Apr 2006 11:29:32 -0700
Hey, all.
I am an Oracle DBA, and learning as much AIX as is required for my job.
That requirement is slowly, and inevitably growing, in terms of the
complexity of the shell scripts that I need.
I need to create a script, wherein:
DIR1 and DIR2 are examined for files.
In DIR1, the files will be of filename DAT1_001, DAT1_002, DAT1_003,
etc.
In DIR2. the files will be of filename DAT2_001, DAT2_002, DAT2_003,
etc.
In each case, DAT2* is a direct copy of DAT1*, renamed accordingly.
A process in a database is responsible for creating copies of DAT2*
based on DAT1*.
However, occasionally a file is missed in DIR2. It exists in DIR1, but
the copy does not always make it to DIR2.
Given the circumstances under which this happens, this is acceptable,
and expected. I just have to 'deal with it'. ***(For the Oracle people
among you, this is about making a standby database; these files make up
the redo log stream for the master and the standby, and when I flip the
standby from read-only reporting mode into recovery mode I am forced to
do an instance restart, which often interrupts the redo stream from the
primary, resulting in a missed file)***
Anyway. I need to make a shell script which will examine these
directories, and for each file DIR1/DAT1_###, confirm that a
DIR2/DAT2_### exists. If it does not, copy the file from DIR1 and
rename it.
I think this will involve sed or awk, neither of which I understand
well. I am about to start learning what I need to to accomplish this
task, but a script from some library somewhere which accomplishes a
similar task would be a great help to me, as opposed to 'working from
scratch'.
Can anyone suggest a resource I might look to for such samples?
Thanks!!
BD
.
- Follow-Ups:
- Re: QUESTION: script for synchronizing directories
- From: base60
- Re: QUESTION: script for synchronizing directories
- Prev by Date: Re: help recovering from stupid 'rm' trick
- Next by Date: Re: QUESTION: script for synchronizing directories
- Previous by thread: iptrace vs tcpdump
- Next by thread: Re: QUESTION: script for synchronizing directories
- Index(es):