Skip to content

lh9171338/Sync-File

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sync-File

这是一个服务器文件同步工具

安装

git clone git@github.com:lh9171338/Sync-File.git

# 安装依赖库
cd Sync-File
python -m pip install -r requirements.txt

SSH配置

# 生成ssh密钥
ssh-keygen

# 将密钥拷贝至服务器,实现免密码SSH文件拷贝
ssh-copy-id user@host

运行

python sync_file.py [--config_file <CONFIG_FILE> --sync_time <SYNC_TIME>]

# 示例,每天一点进行一次代码同步
python sync_file.py --config_file config.json --sync_time 01:00

# 后台运行
nohup python sync_file.py --config_file config.json --sync_time 01:00 &

参数说明

  • config_file:json格式配置文件,示例如下,更新信息请参考config.json
[
    {
        "sync": false,  # 是否同步,true表示同步,false表示不同步
        "src_path": "user@host:src_path",   # 源路径
        "dst_path": "dst_path",  # 备份路径
        "exclude" : ["data", "py38"]   # 无需备份的子文件/子文件夹,一般是不经常修改的大文件/文件夹
    }
]
  • sync_time:每天同步的时间,格式为HH:MM,例如01:00

About

Server file synchronization tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages