Linux - Virtualization and CloudThis forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Not sure how to continue script stop and I'm new to scripting
Code:
#!/bin/bash
#: description : This script will create a template from source vm and then clone the to a new hypervisor.
#: Note : This script assume that vm's location is /images and user name and password for both hypervisor is XXXX XXXX
cd /images
virsh list --all
#read -p 'Please enter source vm FULL NAME from the above list: '
echo -n 'Please enter source vm from the above list: '
read source
echo "This is the source vm ${source}!!!"
virsh suspend $source
cp_source=`echo $source | cut -d - -f -4`
cp -p /images/$cp_source/*.img /images/$cp_source/template.img.`date +%Y.%m.%d.%H.%M.%S`
Confused by your post:
The sentence "Not sure how to continue script stop and I'm new to scripting" makes little sense. What are you asking?
You're 'new to scripting'??? You were posting about scripts SEVEN YEARS AGO. Seven years of experience (along with being a member here for ELEVEN YEARS), says you're not a 'newbie'.
You say you have two Red Hat 'certifications'....and scripting is part of the tests.
Please clarify your question; what isn't your script doing that you WANT it to do?
you are right it's a bit confusing so let me make it clear, When finish learning school about 8 years ago I couldn't find a job in the linux platform what I did find was a job a IT microsoft sys admin.
Only about 7 months ago I started a job as a linux Junior sys admin that's why I don't have enough experience, the fact that I have the cert it's but without experience not much I can do with them(Maybe it's better to take off my profile)
back to my issue I posted it late last night and was very frustrated and tired, what I'm trying to achieve is vm clone from one hypervisor to another.
My source vm's have been installed from pxe which maintain by a different team all of my vm's name look like this:
this morning I found out that the space I have in this line before the "-4" cause the script to stop: cp_source=`echo $source | cut -d - -f -4`
Thx for you comment any tip on how to continue will be great.
in general my plan is to suspend the source vm, cp to create a template, resume source vm, sysprep my template with virt-sysprep, ssh to new hypervisor create new destination dir under /images, scp to old hypervisor and cp my template, setup my hostname + networking and install new vm using virt-install
Hi,
you are right it's a bit confusing so let me make it clear, When finish learning school about 8 years ago I couldn't find a job in the linux platform what I did find was a job a IT microsoft sys admin. Only about 7 months ago I started a job as a linux Junior sys admin that's why I don't have enough experience, the fact that I have the cert it's but without experience not much I can do with them(Maybe it's better to take off my profile)
And none of that changes the fact that you have two 'certifications', and have been working with Linux for 7 months.
Quote:
back to my issue I posted it late last night and was very frustrated and tired, what I'm trying to achieve is vm clone from one hypervisor to another. My source vm's have been installed from pxe which maintain by a different team all of my vm's name look like this:
this morning I found out that the space I have in this line before the "-4" cause the script to stop: cp_source=`echo $source | cut -d - -f -4`
Ok, so 'stop' with what error?? Did you read the man page for the command? Try to enter it manually on the command line to see if it works??? These are basic troubleshooting steps.
Quote:
Thx for you comment any tip on how to continue will be great. in general my plan is to suspend the source vm, cp to create a template, resume source vm, sysprep my template with virt-sysprep, ssh to new hypervisor create new destination dir under /images, scp to old hypervisor and cp my template, setup my hostname + networking and install new vm using virt-install Thx again and sorry for the confusion.
You need to read the LQ Rules about text-speak and not using it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.