mirror of
https://github.com/tuna/tunasync.git
synced 2025-12-25 22:02:46 +00:00
worker rsync 方式增加 --include-from 选项 \n worker配置文件增加 include_file 参数即可
This commit is contained in:
parent
ef78563b8c
commit
fc935d7b7d
|
|
@ -124,6 +124,7 @@ type mirrorConfig struct {
|
|||
Command string `toml:"command"`
|
||||
UseIPv6 bool `toml:"use_ipv6"`
|
||||
UseIPv4 bool `toml:"use_ipv4"`
|
||||
IncludeFile string `toml:"include_file"`
|
||||
ExcludeFile string `toml:"exclude_file"`
|
||||
Username string `toml:"username"`
|
||||
Password string `toml:"password"`
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ func newMirrorProvider(mirror mirrorConfig, cfg *Config) mirrorProvider {
|
|||
username: mirror.Username,
|
||||
password: mirror.Password,
|
||||
excludeFile: mirror.ExcludeFile,
|
||||
includeFile: mirror.IncludeFile,
|
||||
workingDir: mirrorDir,
|
||||
logDir: logDir,
|
||||
logFile: filepath.Join(logDir, "latest.log"),
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
type rsyncConfig struct {
|
||||
name string
|
||||
rsyncCmd string
|
||||
upstreamURL, username, password, excludeFile string
|
||||
upstreamURL, username, password, excludeFile,includeFile string
|
||||
workingDir, logDir, logFile string
|
||||
useIPv6, useIPv4 bool
|
||||
interval time.Duration
|
||||
|
|
@ -41,8 +41,8 @@ func newRsyncProvider(c rsyncConfig) (*rsyncProvider, error) {
|
|||
}
|
||||
|
||||
options := []string{
|
||||
"-aHvh", "--no-o", "--no-g", "--stats",
|
||||
"--exclude", ".~tmp~/",
|
||||
"-aHvh", "--no-o", "--no-g", "--stats", "-n",
|
||||
"--exclude", ".~tmp~/","--include",
|
||||
"--delete", "--delete-after", "--delay-updates",
|
||||
"--safe-links", "--timeout=120", "--contimeout=120",
|
||||
}
|
||||
|
|
@ -53,6 +53,10 @@ func newRsyncProvider(c rsyncConfig) (*rsyncProvider, error) {
|
|||
options = append(options, "-4")
|
||||
}
|
||||
|
||||
if c.includeFile !="" {
|
||||
options = append(options, "--include-from", c.includeFile)
|
||||
}
|
||||
|
||||
if c.excludeFile != "" {
|
||||
options = append(options, "--exclude-from", c.excludeFile)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue