Rsync 在文件大小更改时创建新文件
我需要在程序运行的同时备份(用于调试)一些临时文件。我曾经使用 rsync
来完成此操作 - 使用 find 搜索
,效果很好。/var/tmp/someprogram
目录。 -iname 'blahblah' -exec rsync -someoptions $DESTdir
除了某些程序中某人的情况(我没有源代码访问权限,而且永远不会有源代码访问权限 - 悲伤的,从 COBOL 开始的长故事......)使用某个程序中的新内容覆盖临时文件。
例如,
- 启动
PROG
程序 - 这会在
tmp
目录中创建一个B1237
文件(并且我在每个几分钟) - 当 PROG 完成 B123 的处理后,它会开始另一个循环并使用新内容重新创建
B1237
,并且rsync
-ed 文件将被覆盖。我也需要第一个版本。
有可能以简单的方式实现吗?我正在考虑对 DEST 目录进行时间戳 gzip 压缩,但应该有另一种方法(无需在 dest 目录中创建(例如)git
存储库,并在同步后提交...
更新: 我没有提到 - 抱歉 - 我无权在此 SLES9(企业)服务器上安装任何内容。
提前致谢!
I need to backup (for debugging) some temporary files meanwhile a program running. I used to do it with rsync
-ing the /var/tmp/someprogram
directory with find . -iname 'blahblah' -exec rsync -someoptions $DESTdir
, which works wonderful.
Except the case of someone in some program (for which I don't have source code access, and never will have - sad, and long story starting with COBOL...) overwrites the temporary file with new content from within the some program.
E.g.
- Starting
PROG
program - This creates a
B1237
file in thetmp
dir (and I'mrsync
ing in every few minutes) - After the PROG finishes the processing of B123 it starts another cycle and recreates
B1237
with new content, and thersync
-ed file will be overwritten. And I need the first version as well.
Is it possible in an easy way? I was thinking about timestapped gzipping of the DEST dir, but there should be another way (without creating a (e.g.) git
repo in the dest dir, and commiting after syncing...
Update:
I did not mention - sorry - that I don't have the rights to install anything on this SLES9 (corporate) server.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想做一些比 cp --archive 更节省空间的事情,您可能需要看看 faubackup。
In case you want to do something more space-efficient than
cp --archive
, you might want to look atfaubackup
.