CentOSThis forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.
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.
i have made a shell script but i need to know if i need a wait command in-between my commands, because the first command takes ages to copy over something (about 5 minutes) and the next command is the next line, so will it not complete the copy off?
no, you should not do that. The normal flow means every command will wait for the previous to complete. So you do not need to do anything. But probably you started some background processes, which will run independently and therefore you need to check if that one already completed or not. Without knowing your script we assume you have no backround jobs and therefore all the commands will be executed strictly one by one, one after another...
vim-cmd vmsvc/power.shutdown VMID
mkdir /vmfs/volumes/datastore1/clone
vmkfstools -i /vmfs/volumes/datastore1/source/server.vmdk /vmfs/volumes/datastore1/dest/clone/server.vmdk
**the above line the copy is quite a long time as its copying a virtual hard drive**
cp /vmfs/volumes/datastore1/source/server.vmx /vmfs/volumes/datastore1/dest/clone
vim-cmd solo/registervm /vmfs/volumes/datastore1/dest/clone/server.vmx
vim-cmd vmsvc/power.on VMID
i believe wait is not necessary; please post the output of your modified script below:
Quote:
Originally Posted by robertkwild
Code:
vim-cmd vmsvc/power.shutdown VMID
mkdir /vmfs/volumes/datastore1/clone
echo schneidz-debug: callling vmkfstools -- waiting for it to complete
vmkfstools -i /vmfs/volumes/datastore1/source/server.vmdk /vmfs/volumes/datastore1/dest/clone/server.vmdk
echo schneidz-debug: returning from vmkfstools -- complete
#**the above line the copy is quite a long time as its copying a virtual hard drive**
echo schneidz-debug: continuing with copy
cp /vmfs/volumes/datastore1/source/server.vmx /vmfs/volumes/datastore1/dest/clone
vim-cmd solo/registervm /vmfs/volumes/datastore1/dest/clone/server.vmx
vim-cmd vmsvc/power.on VMID
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.