我需要从此目录列表中仅同步 Web 目录。我使用 Debian 发行版和带有 rsync 协议的 rsnapshot 来传输数据。
clients
├── client3
│ ├── site1.eu -> /var/www/clients/client3/web12/
│ ├── site2.it -> /var/www/clients/client3/web2/
│ ├── site3.it -> /var/www/clients/client3/web1658/
│ ├── web12
│ │ ├── cgi-bin
│ │ ├── log -> /var/log/panel/httpd/site1.eu
│ │ ├── ssl
│ │ ├── tmp
│ │ └── web <<<< TO INCLUDE
│ ├── web1658
│ │ ├── cgi-bin
│ │ ├── log -> /var/log/panel/httpd/site2.it
│ │ ├── ssl
│ │ ├── tmp
│ │ └── web <<<< TO INCLUDE
│ └── web2
│ ├── cgi-bin
│ ├── log -> /var/log/panel/httpd/site3.it
│ ├── ssl
│ ├── tmp
│ └── web <<<< TO INCLUDE
.
.
.
.
这就是我要的:
clients
├── client3
│ ├── site1.eu -> /var/www/clients/client3/web12/
│ ├── site2.it -> /var/www/clients/client3/web2/
│ ├── site3.it -> /var/www/clients/client3/web1658/
│ ├── web12
│ │ └── web
│ ├── web1658
│ │ └── web
│ └── web2
│ └── web
.
.
.
.
这是 Web 服务器中的 rsyncd 配置文件
# RSYNCD CONFIG FILE
log file =/var/log/rsyncd.log
[WEBSITES]
path = /var/www/clients/
read only = yes
list = yes
uid = 0
gid = 0
hosts allow = 123.123.123.132
max connections = 25
socket options = SO_KEEPALIVE
include from = /etc/rsyncd.rules
[secure]
secrets file = /etc/rsyncd.secrets
list = false
谢谢
答案1
转到源文件系统中的客户端目录。然后,您可以使用以下命令
rsync -R -r client3/*/web*/web target_clients_folder
确保获得正确的目标和源匹配。否则您的文件可能会被复制到其他地方。
本质上您应该使用 -R -r 选项和包含一些 * 字符的表达式。