Ignore:
Timestamp:
Oct 3, 2010, 1:19:59 PM (14 years ago)
Author:
rock
Message:

Modify: 精簡化
Add: 一次產生全部DRBL Clinet VM 設定檔(drbl_PXE_PV-VM_create_all)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • drbl-virt/sbin/drbl_PXE_PV-VM_create

    r207 r208  
    2626# = 2. Functions declation =
    2727Usage(){
    28 echo "Usage: drbl_PXE_PV-VM_create.sh options"
     28echo "Usage: drbl_PXE_PV-VM_create [options]"
    2929echo "Options: "
    3030echo "-v|--vm      vm name"
     
    3232echo "-r|--ram     ram size(M) (default: 128)"
    3333echo "Examples: "
    34 echo "drbl_PXE_PV-VM_create.sh options -v drbl131 -c 2 -r 512"
     34echo "drbl_PXE_PV-VM_create -v drbl131 -c 2 -r 512"
    3535}
    3636
     
    3939check_root
    4040# = 1. Parse parameters =
    41 if [ $# -eq 0 ]; then
    42 Usage && exit
    43 fi
    44 
    4541while [ $# -gt 0 ]; do
    4642    case "$1" in
     
    108104[ -z $vm_name ] && echo "[Error] no VM name" && Usage && exit 2
    109105# check vm_name exist
    110 vm_IP_files=$(ls $Work_Home/etc/IP_VM_eth*)
     106IP_VM_files=$(ls $Work_Home/etc | grep 'IP_VM_eth[0-9]$')
    111107vm_exist_jude="no"
    112 for vm_IP_file in $vm_IP_files
     108for vm_IP_file in $IP_VM_files
    113109do
    114     if [ -n "$(grep "$vm_name" $vm_IP_file)" ]; then
     110    if [ -n "$(grep "$vm_name" $Work_Home/etc/$vm_IP_file)" ]; then
    115111        vm_exist_jude="yes"
    116112    fi
     
    126122# = 2. Get VM MAC address =
    127123#IP_MAC_files=$(ls $Work_Home/etc | grep 'macadr-VM-eth[0-9]*.txt')
    128 
    129 IP_VM_files=$(ls $Work_Home/etc | grep 'IP_VM_eth[0-9]*')
    130124IP_VM_right_file=""
    131125IP_VM_right_line=""
Note: See TracChangeset for help on using the changeset viewer.