Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How to run a command when a directory’s contents are updated?

Any one know how to monitor files in Unix. I want to take backup of that files when its modified and store it in another server.

share|improve this question

marked as duplicate by jasonwryan, manatwork, warl0ck, Stéphane Chazelas, Caleb Nov 2 '12 at 12:10

This question was marked as an exact duplicate of an existing question.

    
@jasonwryan As far as I know inotify is a GNU/Linux tool. If the OP has some other UNIX this will not work. – qbi Nov 2 '12 at 7:39
1  
@qbi That may be true, but in the absence of any indication as to what OS he is running, I think it reasonable to assume it is Linux. There is an inotify for BSD as well... – jasonwryan Nov 2 '12 at 7:42

rsync can do that, it will copy only changed files. But it requires to be scheduled. It doesn't monitor a file to copy it upon change, rather it checks for changed files every time when run. Your question is not very specific so it is difficult to give a detailed answer, but I have the impression you want to check the man rsync for --include and --exclude. You can schedule a command like this using cron

share|improve this answer

You would have to run something like Tripwire which would alert you or do an action when it detected a change.

A simpler method would be to use find

find (path to files) -mmin 60 -type f

you can then do something like

find (path to files) -mmin 60 -type f -exec gzip -9 {} \; -exec mv {}.gz_`date +%F`.gz (path to new location) \;
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.