I wanted a strange auto backup settings in / etc /.
Install the git and incrond daemon version control system that keeps track of file changes.
# cd / etc /
# git init
# git add -A *
# git commit -a -m "garden will be here"
from the root:
# incrontab -e
we enter:
/ etc IN_MODIFY, IN_CREATE /path/to/back/script/git_bak.sh
')
now when creating or changing a file in / etc incrond will pull / path / to / back / script / git_bak.sh
The backup script is very simple.
$ cat git_bak.sh
#! / bin / bash
# Script for backup settings.
cd / etc && git add *; git commit -a -m "Autocommit date"
Unfortunately, incrond does not track changes in subfolders.
Now you are spoofing in some config file, you can make a git checkout config, and everything will return to normal.