终止 Unix 压缩进程
我在 PBS 集群上使用 xz 压缩实用程序;我刚刚意识到我允许的压缩作业时间不够长,因此想重新启动它们(然后,大概我需要包含已经创建的 .xz在新的存档文件中?)。终止作业是否安全,或者这可能会损坏已创建的 .xz 文件吗?
I'm using the xz zipping utility on a PBS cluster; I've just realised that the time I've allowed for my zipping jobs won't be long enough, and so would like to restart them (and then, presumably, I'll need to include the .xz that has already been created in the new archive file?). Is it safe to kill the jobs, or is this likely to corrupt the .xz files that have already been created?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定在集群中使用 xz 的含义,但一般来说,终止 xz 进程(或任何合适的压缩实用程序)应该只会影响正在压缩的文件进程终止的时间。更具体地说:
已压缩的输入文件的任何输出文件不应受到影响。生成的
.xz
压缩文件应保持完全可用。任何尚未处理的输入文件都不应被更改。
终止时正在压缩的输入文件不应受到影响。
前提是使用
SIGTERM
信号终止进程,xz
应该在退出之前自行清理,而不是像SIGKILL
那样无法捕获的信号。更具体地说,它不应留下任何部分输出文件。如果
xz
被暴力杀死,应该(而不是可能)发生的最坏情况是部分压缩文件保留在磁盘,沿着其相应的输入文件。您可能希望确保正确清理此类文件 - 一个好方法是让xz
在与实际存储区域不同的目录中工作,并将文件移入和移出以进行压缩。也就是说,根据压缩数据的重要性,您可能仍然希望采取措施来检测和处理任何损坏的文件。可能有很多病态的情况,事情没有按预期发生……
I am not sure about the implications of using
xz
in a cluster, but in general killing anxz
process (or any decent compression utility) should only affect the file being compressed at the time the process terminates. More specifically:Any output files from input files that have already been compressed should not be affected. The resulting
.xz
compressed files should remain perfectly usable.Any input files that have not been processed yet should not be altered at all.
The input file that was being compressed at the time of termination should not be affected.
Provided that the process is terminated using the
SIGTERM
signal, rather than a signal than cannot be caught likeSIGKILL
,xz
should clean-up after itself before exiting. More specifically, it should not leave any partial output files around.If
xz
is killed violently, the worst that should (as opposed to might) happen is for a partial compressed file to remain on the disk, right along its corresponding input file. You may want to ensure that such files are cleaned up properly - a good way is to havexz
work in a separate directory from the actual storage area and move files in and out for compression.That said, depending on the importance of the compressed data, you may still want to incorporate measures to detect and deal with any corrupt files. There can be a lot of pathological situations where things do not happen as they are supposed to...