Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 

Directory monitoring

Sebastien Masson
Valued Contributor

Directory monitoring

Hi all,

Someone know a tool or a script that can monitor a specific directory for any new file creation. I want to mirror my Oracle redo log file on an external FTP server but I don't want to sync the directory each hour... I want to copy the file when they appear in the oraarch...

Darrell Allen
Honored Contributor

Re: Directory monitoring


I haven't used it but rdist sounds like it may do that. It is available from the Software Porting and Archive Centres. One is:

"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Steve Steel
Honored Contributor

Re: Directory monitoring


touch a file ex /tmp/checkdir before you start
with an old date

Then something like this running every hour

find $dir -type f -newer $test > $work
touch $test
typeset -i found=$(cat $work|wc -l)
if [ "$found" -gt "0" ]
cat $work|while read line
echo ftp $line to remote
/bin/rm $work 2>/dev/null

If file are found newer than the checkfile you can ftp them or rcp them

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
harry d brown jr
Honored Contributor

Re: Directory monitoring


You really want to do it when the file is closed, for this test I'd suggest getting "lsof" from:

and writing a perl program monitor directory changes. It's important to make sure the file is no longer "inuse". Also with perl you can ftp directly from it.

live free or die
Live Free or Die
Frequent Advisor

Re: Directory monitoring

Harry, to do that we can use the "fuser -u $filename" command. The perl language is not necessary.

Eric Ladner
Trusted Contributor

Re: Directory monitoring

Just a process check.

Oracle redo logs are created when the database is created and don't change on a daily basis (the contents change, the file doesn't)

If you really want to copy your redo logs somewhere, turn archivelog mode on and tell oracle where to put the archived redo logs when they are switched out.