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.
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.
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
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) \;
inotify
is a GNU/Linux tool. If the OP has some other UNIX this will not work. – qbi Nov 02 '12 at 07:39inotify
for BSD as well... – jasonwryan Nov 02 '12 at 07:42