【问题标题】:clonezilla copy log-file(s) to usb-deviceclonezilla 将日志文件复制到 USB 设备
【发布时间】:2015-03-20 12:37:07
【问题描述】:

我想使用 clonezilla-live usb-stick 创建/恢复完全无人值守的系统映像。到目前为止,无人值守的备份/恢复工作正常。我只是插上棒,启动电脑,工作完成后电脑关机。

现在我需要确认备份/恢复是否成功。 为此,我想执行一个 shell 脚本,在工作完成后将日志文件复制到特定文件到 USB 棒上的另一个分区。

我尝试在 syslinux.cfg 中将脚本作为 postrun-method 执行,但这总是导致错误。 此外,我使用 drbl-ocs 进行了尝试,但我不确定我是否做对了。

这是我要执行的shell脚本:

#!/bin/sh

#############
/opt/drbl/sbin/ocs-sr -q2 -j2 -z1p -i 4096 -p true savedisk img sda
#############
dir=/home/partimag/logs/

time=$(date +"%H-%M-%S")    # current time
i=$(ls -l $dir | wc -l)     # index

# create log-directory if it didn't exist
if [ ! -e $dir ] 
then
    sudo mkdir $dir
fi

# create new log-directory (
sudo mkdir $dir/$i"_"@$time

# copy all log-files to the created directory
sudo cp /var/log/* $dir/$i"_"@$time

# shut-down the machine
sudo shutdown -h now

第一条指令(在 shebang 之后)是我尝试使用 drbl-ocs,但我真的不知道这是什么。我相信它也是另一个可以处理 shell 脚本的解释器。我说的对吗?

这里是我使用的 syslinux.cfg:

append initrd=/live/initrd.img boot=live username=user config quiet noswap     edd=on nomodeset nodmraid noeject locales=en_US.UTF-8 keyboard-layouts=NONE ocs_prerun="mount /dev/sdb2 /mnt/" ocs_prerun1="mount --bind /mnt/ /home/partimag/" ocs_live_run="/lib/live/mount/medium/syslinux/clonezilla.sh" ocs_live_extra_param="" ocs_live_batch="yes" vga=788 ip=  nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1

请帮忙! 谢谢:)

【问题讨论】:

    标签: linux shell logging clonezilla


    【解决方案1】:

    好的:)

    唯一要做的就是在 ocs_live_run 方法前面添加解释器。

    现在 syslinux.cfg 看起来像这样:

    append initrd=/live/initrd.img boot=live username=user config quiet noswap edd=on nomodeset nodmraid noeject locales=en_US.UTF-8 keyboard-layouts=NONE ocs_prerun="mount /dev/sdb2 /mnt/" ocs_prerun1="mount --bind /mnt/ /home/partimag/" ocs_live_run="bash /lib/live/mount/medium/syslinux/clonezilla.sh" ocs_live_extra_param="" ocs_live_batch="yes" vga=788 ip=  nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1
    

    如果这对您有用,请评价 :)

    【讨论】:

      猜你喜欢
      • 2011-09-03
      • 1970-01-01
      • 2016-03-06
      • 2021-10-12
      • 1970-01-01
      • 1970-01-01
      • 2011-01-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多