AIX 4.3.3.0-10 - Oracle 8.1.7.4
I'm trying to write a bourne script to periodically backup the Oracle archive redo files to a different server just to cover my arse. However, I don't want to make the mistake of copying a file that is in the process of being written. Is there a simple AIX command-line method for determining if a file is open, and therefore should not be copied?
I'm thinking of something along the lines of:
for fil in `ls archive*`
do
<test to see if file is open, and if so, set a variable>
if <variable in previous step not set>
cp $fil backup-location
else
mail -s "$fil was open and was not copied" me@my.com
fi
done
Ideas?
Thanks,
Unca Xitron
I'm trying to write a bourne script to periodically backup the Oracle archive redo files to a different server just to cover my arse. However, I don't want to make the mistake of copying a file that is in the process of being written. Is there a simple AIX command-line method for determining if a file is open, and therefore should not be copied?
I'm thinking of something along the lines of:
for fil in `ls archive*`
do
<test to see if file is open, and if so, set a variable>
if <variable in previous step not set>
cp $fil backup-location
else
mail -s "$fil was open and was not copied" me@my.com
fi
done
Ideas?
Thanks,
Unca Xitron