rsync 忽略 --SUFFIX 选项

发布于 2024-07-07 08:48:18 字数 423 浏览 5 评论 0原文

rsync -auve ssh --backup --suffix='2008-10-03-1514539' --backup-dir='/tmp/' module.pm root@web1:/path/to/module.pm

我在没有 --backup-dir 选项的情况下运行此命令,当它复制文件时,它会创建一个具有当前时间戳的备份。 当我包含 --backup-dir 选项时,它会将备份保存到 /tmp/ 目录中,但不会附加我的后缀。

手册中没有任何内容表明您不能使用这两个选项一起。 我也尝试过这个命令,但似乎没有什么可以解决它。

有人有解决办法吗?

rsync -auve ssh --backup --suffix='2008-10-03-1514539' --backup-dir='/tmp/' module.pm root@web1:/path/to/module.pm

I run this command without the --backup-dir option and when it copies the file over, it creates a backup with a current timestamp. When I include the --backup-dir option, it makes the backup into the /tmp/ directory but never attaches my suffix.

There is nothing in the manual to suggest that you can't use both these options together. I've played around with the order also and nothing seems to fix it.

Does anyone have a solution to this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

红焚 2024-07-14 08:48:18

手册说:

--backup 进行备份(请参阅 --suffix 和 --backup-dir)

--backup-dir=DIR 将备份制作为基于 DIR 的层次结构

--suffix=SUFFIX 备份后缀(默认 ~ w/o --backup-dir)

所以看来您可以使用其中之一,而不是两者都使用(因为我猜您想要一种方法来确定您使用后缀或目录的备份)。

作为解决此问题的方法,为什么不保留后缀并修改目标以包含备份目录。

the manual says:

--backup make backups (see --suffix & --backup-dir)

--backup-dir=DIR make backups into hierarchy based in DIR

--suffix=SUFFIX backup suffix (default ~ w/o --backup-dir)

so it seems that you can use one or the other, not both (as I guess you want a way to determine what's a backup you use a suffix or a directory).

As a way to fix this, why don't you keep the suffix and modify the destination to include the backup directory.

幻想少年梦 2024-07-14 08:48:18

你也可以使用这样的东西

# Backup
mkdir -p /tmp/`date +\%Y-\%m-\%d`-`date +\%A`/
rsync -avz /tmp/`date --date=yesterday +\%Y-\%m-\%d`-`date --date=yesterday +\%A`/ /tmp/`date +\%Y-\%m-\%d`-`date +\%A`/
rsync -avz -e ssh root@web1:/path/to/module.pm /tmp/`date +\%Y-\%m-\%d`-`date +\%A`/

You could also use something like this

# Backup
mkdir -p /tmp/`date +\%Y-\%m-\%d`-`date +\%A`/
rsync -avz /tmp/`date --date=yesterday +\%Y-\%m-\%d`-`date --date=yesterday +\%A`/ /tmp/`date +\%Y-\%m-\%d`-`date +\%A`/
rsync -avz -e ssh root@web1:/path/to/module.pm /tmp/`date +\%Y-\%m-\%d`-`date +\%A`/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文