您可以使用 inotify cron(incron) 和 git(快速版本控制系统)
安装图标:
sudo apt-get install incron
Run Code Online (Sandbox Code Playgroud)
安装git:
sudo apt-get install git-core
Run Code Online (Sandbox Code Playgroud)
允许 root 使用 incron:
echo "root" > /etc/incron.allow
Run Code Online (Sandbox Code Playgroud)
创建 git 存储库:
mkdir /git
cd /git
git init
Run Code Online (Sandbox Code Playgroud)
创建脚本以自动提交 /usr/local/sbin/git-autocommit:
#!/bin/bash
REP_DIR="/git"
NOTIFY_DIR="/srv"
cd $REP_DIR
GIT_WORK_TREE=$NOTIFY_DIR /usr/bin/git add .
GIT_WORK_TREE=$NOTIFY_DIR /usr/bin/git commit -a -m "auto"
Run Code Online (Sandbox Code Playgroud)
添加 incron 规则:
sudo incrontab -e
/srv IN_MODIFY,IN_CREATE,IN_MOVED_FROM,IN_MOVED_TO /usr/local/sbin/git-autocommit
Run Code Online (Sandbox Code Playgroud)
我喜欢 git 和 Ubuntu)