2013-05-18 2 views
1

사용자 정의 clonezilla를하고 있습니다. 하나는 원본 디스크가 ocs-onthefly ...로 원격 디스크에 로컬 디스크를 보내는 것입니다. custom-ocs가 정상적으로 작동하고 있습니다.ocs-onthefly 명령에서 Clonezilla custom-ocs bash 스크립트가 실패했습니다.

그러나 대상에 대한 custom-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는 여기에 있습니다 : 나는 에코 (안 clonezilla 내에서하지만 단지 리눅스 상자) 대화 상자 출력을 통해 테스트 할 때

#!/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 

: https://www.dropbox.com/s/9mfrt0n50sheayn/custom-ocs_destination-REVISED.txt

또한 코드 블록을 시도 $ src_ip와 $ dest_disk에 대해서도 변수를 출력하므로 ocs-onthefly가 왜 그것을 받아들이지 않는지 모르겠습니다.

답변

1

예기치 않은 인수가있는 ocs-onthefly 명령이 표시됩니다. 분석하기 위해, 더 나은 어쩌면

echo /usr/sbin/ocs-onthefly -s $src_ip -t $dest_disk 

또는, 무엇이 잘못되었는지를 알려줍니다

bash -x script 

으로 스크립트를 실행 한 결과와 실제 명령을 볼 수 있습니다.

관련 문제