tunasync是如何调用使用tunathu/ftpsync的
alex1528 opened this issue · 2 comments
alex1528 commented
tunasync是如何调用使用tunathu/ftpsync的
Harry-Chen commented
请参见下列代码
Lines 36 to 67 in 38a9475
if d := provider.Docker(); d != nil { | |
c := "docker" | |
args := []string{ | |
"run", "--rm", | |
"-a", "STDOUT", "-a", "STDERR", | |
"--name", d.Name(), | |
"-w", workingDir, | |
} | |
// specify user | |
args = append( | |
args, "-u", | |
fmt.Sprintf("%d:%d", os.Getuid(), os.Getgid()), | |
) | |
// add volumes | |
for _, vol := range d.Volumes() { | |
logger.Debugf("volume: %s", vol) | |
args = append(args, "-v", vol) | |
} | |
// set env | |
for k, v := range env { | |
kv := fmt.Sprintf("%s=%s", k, v) | |
args = append(args, "-e", kv) | |
} | |
// apply options | |
args = append(args, d.options...) | |
// apply image and command | |
args = append(args, d.image) | |
// apply command | |
args = append(args, cmdAndArgs...) | |
cmd = exec.Command(c, args...) | |
shankerwangmiao commented
配置参见:
tunasync/docs/zh_CN/workers.conf
Lines 182 to 194 in 38a9475
[[mirrors]] | |
name = "debian" | |
provider = "command" | |
upstream = "rsync://mirrors.tuna.tsinghua.edu.cn/debian/" | |
command = "/home/scripts/debian.sh sync:archive:debian" | |
size_pattern = "Total size is ([0-9\\.]+[KMGTP]?)" | |
docker_image = "tunathu/ftpsync" | |
docker_volumes = [ | |
"/etc/misc/ftpsync-debian.conf:/ftpsync/etc/ftpsync-debian.conf:ro", | |
"/log/ftpsync:/home/log/tunasync/ftpsync", | |
] | |
[mirrors.env] | |
FTPSYNC_LOG_DIR = "/home/log/tunasync/ftpsync" |