I have a Debian powered NAS server (ReadyNAS) with a deep file hierarchy. I'd like to get notified daily about what has changed in some of its directories and their subdirectories.

So if someone accidentally deletes a file during the day, I'd get notified about it at night by email (which would contain summary of all changes) and restore the file from backup in the morning of the next day.

At first I wanted to write a PHP CL or Python script which would recursively scan the directories, but then I thought that perhaps there is some neat unix tool that does it better. Something like dircmp :)

3 Answers
3

Alternatively, put the whole system under version control. Run the version control tool's diff command to see changes and its revert command (however it's called) to revert any changes in the local copy. Note that most version control systems handle file contents but require extra work for meta data such as permissions.

Alternatively, use a storage system with some form of snapshotting support, such as LVM or virtual machines.