Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ -z $1 ]; then
  4. echo "Usage: $0 [vm name]"
  5. exit 1
  6. else
  7. VM_NAME=$1
  8. fi
  9.  
  10. VM_FILE=/seng/scratch/group3/${VM_NAME}/${VM_NAME}.vbox
  11.  
  12. # Check if VM is a already present
  13. if [ ! -f ${VM_FILE} ]; then
  14. echo "Could not find ${VM_NAME} on $HOSTNAME"
  15. exit 1
  16. fi
  17.  
  18. # Check if we need to register image with VBox
  19. if ! VBoxManage list vms | grep ${VM_NAME} 1> /dev/null; then
  20. # Add if not found
  21. echo "Registering ${VM_FILE}"
  22. VBoxManage registervm ${VM_FILE}
  23. fi
  24.  
  25. # Start up VM
  26. VBoxManage startvm ${VM_NAME} --type headless
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement