After the subconscious worked on this a bit, a solution that I should have thought of, right at the beginning, popped into my head. Unix has a wonderful utility called rdist that is intended for just this sort of thing. If you read the man page, it will talk about a distfile which contains commands for the utility. I rarely use a distfile, and when I do, I have to re-read the man page s-l-o-w-l-y to relearn the syntax for the distfile. I usually use rdist to copy an entire directory tree to another box. A command for this is:
cd /directory/to/copy rdist -wc * other_box:/where/to/copy The spiffy thing about rdist is that it will only copy what is new or has been updated on the source box. By default, I think the decision about what to update is done on the basis of time, but you can tell rdist to perform a binary comparison of files -- a process I think would be a bit time consuming for large files. In the case of your archived logs, this would certainly work, but I think rdist would try to copy any archive that was currently being written. I don't think this would be a problem since, at the next invocation, it would detect that the log that was being written at the previous invocation has been updated and would copy it again. However, if you wanted to avoid this, you could do something like: -------- go.ksh -------------- #!/usr/bin/ksh ## Check that we can rsh to the other box. rsh other_box '/usr/bin/date' > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "Something broke" exit 1 fi cd /the/source/directory COUNT=0 for FILE in `ls -1t *.xyz 2> /dev/null`; do COUNT=$(( $COUNT + 1 )) if [ $COUNT -gt 2 ]; then rdist -wc $FILE other_box:/the/destination/directory fi done -------------------------------- The script will attempt to rdist all but the most recent two archived logs (adjust this in the "if" condition). Any logs that have already been copied will not get copied again, so this will save you from trying to keep track of that (although, when I was thinking about this, one solution for doing that would be to create a soft link to point to last file you copied in the previous invocation). You will need to have a .rhosts file set up on the other box to use rdist. -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Stephen Lee INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).