我正在做一个定制的克隆doing ..一个用于源将本地磁盘发送到具有ocs-onthefly的远程磁盘...该自定义ocs运行良好。
但是,由于某些原因,目标的自定义ocs不起作用。问题是最后一行"/usr/sbin/ocs-onthefly -s $src_ip -t $dest_disk“。由于某种原因,clonezilla在该行停顿了下来,并给出了用法/帮助输出,而不是运行命令。
对于ocs-onthefly命令不接受参数的原因有什么想法吗?参数是正确的。如果你运行"/usr/sbin/ocs-onthefly -s 192.168.150.1 -t sda“,它运行得很好。
目标脚本的自定义ocs在此处:https://www.dropbox.com/s/9mfrt0n50sheayn/custom-ocs_destination-REVISED.txt
尝试代码块还包括:
#!/bin/bash
# Author: Steven Shiau <steven _at_ nchc org tw>
# License: GPL
# Ref: http://sourceforge.net/forum/forum.php?thread_id=1759263&forum_id=394751
# In this example, it will allow your user to use clonezilla live to choose
# (1) backup the image of /dev/hda1 (or /dev/sda1) to /dev/hda5 (or /dev/sda5)
# (2) restore image in /dev/hda5 (or /dev/sda5) to /dev/hda1 (or /dev/sda1)
# When this script is ready, you can run
# ocs-iso -g en_US.UTF-8 -k NONE -s -m ./custom-ocs
# to create the iso file for CD/DVD. or
# ocs-live-dev -g en_US.UTF-8 -k NONE -s -c -m ./custom-ocs
# to create the zip file for USB flash drive.
# Begin of the scripts:
# Load DRBL setting and functions
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
. /etc/drbl/drbl-ocs.conf
. $DRBL_SCRIPT_PATH/sbin/ocs-functions
# load the setting for clonezilla live.
[ -e /etc/ocs/ocs-live.conf ] && . /etc/ocs/ocs-live.conf
# Load language files. For English, use "en_US.UTF-8".
ask_and_load_lang_set en_US.UTF-8
# The above is almost necessary, it is recommended to include them in your own custom- ocs.
# From here, you can write your own scripts.
# functions
decide_sda_or_hda() {
if [ -n "$(grep -Ew sda1 /proc/partitions)" ]; then
disk=sda
elif [ -n "$(grep -Ew hda1 /proc/partitions)" ]; then
disk=hda
else
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
echo "No hard disk detected!"
echo "Program terminated!"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
fi
# src_part: hda1 or sda1, tgt_part: hda5 or sda5
dest_disk=${disk}
}
##################
###### MAIN ######
##################
# Set network on destination workstation 1
# Determine if active link then set act_eth
while [ -z "$(/sbin/mii-tool 2>/dev/null | awk -F ":" '/link ok/ {print $1}')" ]; do
dialog --title "NO LINK!!" --msgbox "\n Need an active link in order to continue!!" 6 50
done
act_eth=`/sbin/mii-tool 2>/dev/null | awk -F ":" '/link ok/ {print $1}'`
# Set IP Address of destination workstation 1
/sbin/ifconfig $act_eth 192.168.150.2 netmask 255.255.255.0 up
/sbin/route add default gw 192.168.150.254
/bin/echo "nameserver 8.8.8.8" >> /etc/resolv.conf
# Find the disk device
decide_sda_or_hda
# Prompt for IP address of source disk
OUTPUT="./input.txt"
>$OUTPUT
dialog --title "Need SOURCE IP" --inputbox "Enter IP address of the SOURCE server: " 8 60 2>$OUTPUT
src_ip=$(<$OUTPUT)
# Ready the destination disk to receive from source (source should already be waiting in clonezilla), and contact source to start transfer to destination
/usr/sbin/ocs-onthefly -s $src_ip -t $dest_disk当我通过echo (不是在clonezilla中,而是在linux机器上)测试$src_ip和$dest_disk的对话框输出时,它输出的变量都很好,所以我真的不知道为什么ocs-onthefly不接受它。
发布于 2013-05-19 00:57:50
看起来你的ocs-onthefly命令得到了意外的参数。为了进行分析,让我们看看实际的命令
echo /usr/sbin/ocs-onthefly -s $src_ip -t $dest_disk或者,也许更好的是,使用
bash -x script会告诉你哪里出了问题。
https://stackoverflow.com/questions/16626298
复制相似问题