Advertisement
Guest User

VMware workstation backup

a guest
Aug 30th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.17 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Make a backup full clone of the server and copy into a folder based on date.
  4. # Log actions and times in a log file.
  5.  
  6. # Date variable for folder naming.
  7. DATEFILE=`/bin/date +%G%m%d`
  8.  
  9. # Suspend the running virtual server.
  10. vmrun suspend /home/bpcomp/vmware/WindowsServer2008/Windows\ Server\ 2008.vmx
  11.  
  12. # Take a 5 second break before doing the next step.
  13. sleep 5
  14.  
  15. # Log actions.
  16. echo "Server suspended." >/backup/logs/backup_${DATEFILE}.log
  17. echo "Server clone for `date` started." >>/backup/logs/backup_${DATEFILE}.log
  18.  
  19. # Make a clone of the VM to a folder by date.
  20. mkdir /backup/daily/${DATEFILE}
  21. vmrun clone /home/bpcomp/vmware/WindowsServer2008/Windows\ Server\ 2008.vmx /backup/daily/${DATEFILE}/WindowsServer2008.vmx full
  22.  
  23. # Take a 5 second break before doing the next step.
  24. sleep 5
  25.  
  26. # Log actions.
  27. echo "Server clone for `date` completed." >>/backup/logs/backup_${DATEFILE}.log
  28.  
  29. # Once VM is copied, resume the VM.
  30. vmrun start /home/bpcomp/vmware/WindowsServer2008/Windows\ Server\ 2008.vmx
  31.  
  32. # Log actions.
  33. echo "Server resumed `date`." >>/backup/logs/backup_${DATEFILE}.log
  34. echo "Backup completed." >>/backup/logs/backup_${DATEFILE}.log
  35.  
  36.  
  37. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement