尝试运行“gsutil rsync”命令时出现此错误。下面的命令。我在VM实例上从头开始重新安装了Cloud SDK。应用kubectl组件。我是否放入一面旗帜,两面旗帜,三面旗帜。
# gsutil rsync -r -n /var/www/html/* gs://google-storage-bucket/alpha/$(date +%F)
CommandException: The rsync command accepts at most 2 arguments. Usage:
gsutil rsync [-c] [-C] [-d] [-e] [-n] [-p] [-r] [-U] [-x] src_url dst_url
For additional help run:
gsutil help rsync
即使我没有使用标记,我也会收到类似的错误。 (目标路径是已安装的gs://版本 - 相同位置)
# gsutil rsync /var/www/html/* /var/www/_backup/alpha/$(date +%F)
CommandException: The rsync command accepts at most 2 arguments. Usage:
gsutil rsync [-c] [-C] [-d] [-e] [-n] [-p] [-r] [-U] [-x] src_url dst_url
For additional help run:
gsutil help rsync
如果我试图单独执行gsutil rsync,我会收到类似的错误。
# gsutil rsync
CommandException: The rsync command requires at least 2 arguments. Usage:
gsutil rsync [-c] [-C] [-d] [-e] [-n] [-p] [-r] [-U] [-x] src_url dst_url
For additional help run:
gsutil help rsync
WTF gsutility!
正常RSYNC(不通过gsutil)吐出
# rsync /var/www/html/* /var/www/_backup/alpha/$(date +%F)
rsync: change_dir#3 "/var/www/_backup/alpha" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(625) [Receiver=3.0.9]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]
答案 0 :(得分:1)
您需要将/var/www/html/*
更改为/var/www/html
。原因有两方面:
gsutil rsync
正在等待文件夹
(/var/www/html/*
不是文件夹)/var/www/html/*
中的shell将expand the asterisk,因此您的命令行最终可能会有数十个甚至100个参数。