FetchLinux主要用于Linux系統管理,其文件同步與共享功能可通過以下方式實現:
安裝FetchLinux
sudo apt update && sudo apt install fetchlinuxsudo yum install -y git wget curl openssh-server,再克隆倉庫配置。配置同步任務
fetchlinux.conf):[source]
path = /本地/源目錄
[target]
path = user@遠程主機:/遠程/目標目錄
[options]
recursive = true # 遞歸同步
delete = true # 刪除目標多余文件
執行同步操作
fetchlinux sync -c /path/to/config.conffetchlinux sync --reverse -c /path/to/config.conf定時同步
crontab設置定時任務,例如每天凌晨2點同步:0 2 * * * /usr/bin/fetchlinux sync -c /path/to/config.conf >> /var/log/sync.log 2>&1遠程文件訪問
fetchlinux upload /本地/文件 user@遠程主機:/遠程/目錄fetchlinux download user@遠程主機:/遠程/文件 /本地/目錄目錄共享(需配合SSH)
fetchlinux ls user@遠程主機:/遠程/目錄(查看文件列表)fetchlinux -u user@遠程主機 /本地/目錄/ -r /遠程/目錄/(雙向同步共享)fetchlinux --update更新工具版本,確保兼容性。以上操作基于FetchLinux的命令行工具,具體參數可通過fetchlinux --help查看詳細說明。