- 使用 samba 搭建文件共享服务器
- 使用定期执行的 git 脚本,对共享服务器文件进行版本控制
- 使用 gitweb 建立文件访问的网页服务,支持直观的误删恢复
samba 搭建共享服务器
在配置共享服务器时,需要保证写入文件后可以删除,可以设置所有读写使用同一个用户的权限进行。在配置文件中体现为force user = nobody
[Public]
path = /mnt/data/samba_public
writable = yes
guest ok = yes
guest only = yes
read only = no
create mode = 0664
directory mode = 0775
force user = nobody
hide dot files = yes # 避免用户看到隐藏文件,如后面的 .git、.gitignore、.backup.sh
使用 git 增量备份共享文件
在 samba 共享目录根目录下,创建.backup.sh
文件,使用 git 增量备份对目录中文件的变化。
!/bin/bash
script_path=$(dirname $(readlink -f "${0}"))
cd $script_path
find $script_path -size +3G | sed 's|^./||g'
… Read the rest