gpt4 book ai didi

linux - clonezilla 将日志文件复制到 USB 设备

转载 作者:太空宇宙 更新时间:2023-11-04 03:42:32 24 4
gpt4 key购买 nike

我想使用clonezilla-live USB 棒创建/恢复完全无人值守的系统镜像。到目前为止,无人值守的备份/恢复工作正常。我只需插入棒,启动电脑,工作完成后电脑就会关闭。

现在我需要确认备份/恢复是否成功。为此,我想执行一个 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

请帮忙!谢谢:)

最佳答案

好的,明白了:)

唯一要做的就是在 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

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

关于linux - clonezilla 将日志文件复制到 USB 设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29166683/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com