Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的任务是执行 VMware vCenter 设备数据库的备份。我们无法安装适用于 Linux 的 Backup Exec 代理,因此我们将数据库转储到磁盘,然后使用脚本 SCP 将它们转移到另一个 *nix 机器上。
这工作正常,而且我在设备上拥有它,我们只保留一周的备份。
我遇到的问题是确保远程机器上的备份是同步的,所以两台机器上只有几周的时间。
Rsync 没有安装,所以我不知道如何在远程机器上不设置另一个脚本的情况下远程删除它们,而我不想这样做。
任何方式都可以在一个脚本中完成?
如果你可以使用scp,你可能也可以使用ssh来执行远程命令。
scp
ssh
尝试:
ssh user@remote find /some/folder/with/backups -mtime +7 -type f -print
当它工作时,替换-print为-delete(或者-exec rm "{}" \;如果-delete不支持)。
-print
-delete
-exec rm "{}" \;