clonezilla 将日志文件复制到 USB 设备
clonezilla copy log-file(s) to usb-device
我想要 create/restore 一个完全无人值守的系统图像,带有 clonezilla-live USB 棒。到目前为止,无人值守的 backup/restore 工作正常。我只是插入棒,启动电脑,工作完成后电脑关闭。
现在我需要确认 backup/restore 是否成功。
为此,我想执行一个 shell 脚本,在工作完成后将日志文件复制到特定文件到 USB 记忆棒上的另一个分区。
我试图在 syslinux.cfg 中将脚本作为后运行方法执行,但这总是导致错误。
此外,我用 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
如果这对您有用,请评价:)
我想要 create/restore 一个完全无人值守的系统图像,带有 clonezilla-live USB 棒。到目前为止,无人值守的 backup/restore 工作正常。我只是插入棒,启动电脑,工作完成后电脑关闭。
现在我需要确认 backup/restore 是否成功。 为此,我想执行一个 shell 脚本,在工作完成后将日志文件复制到特定文件到 USB 记忆棒上的另一个分区。
我试图在 syslinux.cfg 中将脚本作为后运行方法执行,但这总是导致错误。 此外,我用 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
如果这对您有用,请评价:)