简体   繁体   English

我如何知道(在bash脚本中)clonezilla批处理模式备份是否成功?

[英]how can i tell (in bash script) if a clonezilla batch mode backup succeeded?

This is my first ever post to stackoverflow, so be gentle please. 这是我有史以来第一篇关于stackoverflow的文章,请谨慎。 ;> ;>

Ok, I'm using slightly customized Clonezilla-Live cd's to backup the drives on four PCs. 好的,我使用稍微定制的Clonezilla-Live CD来备份四台PC上的驱动器。 Each cd is for a specific PC, saving an image of its disk(s) to a box-specific backup folder on a samba server. 每张CD用于一台特定的PC,将其磁盘映像保存到samba服务器上特定于盒子的备份文件夹中。 That's all pretty much working. 一切都差不多了。 But once in a while, Something Goes Wrong, and the backup isn't completed properly. 但是有时,出了点问题,并且备份未正确完成。 Things like: the cat bit through a cat5e cable; 事情是这样的:猫咬住了cat5e电缆; I forgot to check if the samba server had run out of room; 我忘了检查samba服务器是否空间不足; etc. And it is not always readily apparent that a failure happened. 等等。失败并不一定总是很明显。

I will admit right now that I am pretty much a noob as far as linux system administration goes, even though i managed somehow to setup a centos 6 box (i wish i'd picked ubuntu...) with samba, git, ssh, and bitnami-gitlab back in february. 我现在就承认,就Linux系统管理而言,我几乎是个菜鸟,尽管我设法以某种方式用samba,git,ssh设置了centos 6框(我希望我选择了ubuntu ...),和二月的bitnami-gitlab。

I've spent days and days and days trying to figure out if clonezilla leaves a simple clue in a backup as to whether it succeeded completely or not, and have come up dry. 我花了几天又几天的时间试图弄清clonezilla是否在备份中留下了一个简单的线索,即它是否完全成功,并且已经干dry了。 Looking in the folder for a particular backup job (on the samba server) I see that the last file written is named "clonezilla-img". 在文件夹中查找特定的备份作业(在samba服务器上),我看到最后写入的文件名为“ clonezilla-img”。 It seems to be a console dump that covers the backup itself. 似乎是控制台转储,涵盖了备份本身。 But it does not seem to include the verification pass. 但这似乎不包括验证通行证。

Regardless of whether the batch backup task succeeded or failed, I can run a post-process bash script automagically, that I place on my clonezilla cds. 无论批备份任务成功还是失败,我都可以自动运行放置在clonezilla cd上的后处理bash脚本。 I have this set to run just fine, though its not doing a whole lot right now. 我现在可以很好地运行它,尽管它现在并没有做很多事情。 What I would like this post-process script to do is determine if the backup job succeeded or not, and then rename (mv) the backup job directory to include some word like "SUCCESS" or "FAILURE". 我希望此后处理脚本执行的操作是确定备份作业是否成功,然后重命名(MV)备份作业目录以包含诸如“ SUCCESS”或“ FAILURE”之类的单词。 I know how to do the renaming part. 我知道如何进行重命名。 It's the test for success or failure that I'm at a loss about. 这是我不知所措的成功或失败的考验。

Thanks for any help! 谢谢你的帮助!

I know this is old, but I've just started on looking into doing something very similar. 我知道这很古老,但是我刚刚开始研究做类似的事情。

For your case i think you could do what you are looking for with ocs_prerun and ocs_postrun scripts. 对于您的情况,我认为您可以使用ocs_prerunocs_postrun脚本来完成所需的工作。

For my setup I'm using a pen/falsh drive for some test systems and also pxe with NFSmount. 对于我的设置,我在某些测试系统中使用了笔式/ falsh驱动器,并在NFSmount中使用了pxe。 PXE and nfs are much easier to test and modify quickly. PXE和nfs更容易快速测试和修改。

I haven't tested this yet, but I was thinking that I might be able to search the logs in /var/log/{clonezilla.log,partclone.log} via an ocs_postrun script to validate success or failure. 我尚未对此进行测试,但是我想我可以通过ocs_postrun脚本在/var/log/{clonezilla.log,partclone.log}中搜索日志,以验证成功或失败。 I haven't seen anything that indicates the result is set in the environment so I'm thinking the logs might be the quick easy method over mounting or running a crc check. 我没有看到任何指示结果已在环境中设置的内容,因此我认为日志可能是安装或运行crc检查的快速简便方法。 Clonezilla does have an option to validate the image, the results of which might be in the local logs. Clonezilla确实有一个验证图像的选项,其结果可能在本地日志中。

Another option might be to create a custom ocs_live_run script to do something similar. 另一种选择是创建自定义ocs_live_run脚本以执行类似的操作。 There is an example at this URL http://clonezilla.org/fine-print-live-doc.php?path=./clonezilla-live/doc/07_Customized_script_with_PXE/00_customized_script_with_PXE.doc#00_customized_script_with_PXE.doc 此URL上有一个示例http://clonezilla.org/fine-print-live-doc.php?path=./clonezilla-live/doc/07_Customized_script_with_PXE/00_customized_script_with_PXE.doc#00_customized_script_with_PXE.doc

Maybe in the script the exit code of ocs-sr can be checked? 也许在脚本中可以检查ocs-sr的退出代码? As I said I haven't tried any of this, just some thoughts. 正如我说过的,我只是尝试过一些想法而已。

I updated the above to reflect the log location (/var/log). 我更新了上面的内容以反映日志位置(/ var / log)。 The logs are in the log folder of course. 日志当然在日志文件夹中。 :p :p

Regards 问候

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM