Created
January 11, 2013 02:20
-
-
Save willscripted/4507446 to your computer and use it in GitHub Desktop.
Script to kill and replace practice vms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in `seq 1 8`; | |
do | |
name="userv-00$i" | |
echo $name | |
# Remove old | |
vboxmanage controlvm $name poweroff | |
vboxmanage storageattach $name --storagectl SATA\ Controller --port 0 --type hdd --device 0 --medium none | |
vboxmanage closemedium disk ../$name/$name.vdi --delete | |
# Create new | |
vboxmanage clonehd ubuntu-12.04-basebox.vdi $name.vdi | |
mv ./$name.vdi ../$name/ | |
# Attach | |
vboxmanage storageattach $name --storagectl SATA\ Controller --medium ../$name/$name.vdi --type hdd --port 0 | |
vboxmanage startvm $name --type headless | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment