Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Make a backup full clone of the server and copy into a folder based on date.
- # Log actions and times in a log file.
- # Date variable for folder naming.
- DATEFILE=`/bin/date +%G%m%d`
- # Suspend the running virtual server.
- vmrun suspend /home/bpcomp/vmware/WindowsServer2008/Windows\ Server\ 2008.vmx
- # Take a 5 second break before doing the next step.
- sleep 5
- # Log actions.
- echo "Server suspended." >/backup/logs/backup_${DATEFILE}.log
- echo "Server clone for `date` started." >>/backup/logs/backup_${DATEFILE}.log
- # Make a clone of the VM to a folder by date.
- mkdir /backup/daily/${DATEFILE}
- vmrun clone /home/bpcomp/vmware/WindowsServer2008/Windows\ Server\ 2008.vmx /backup/daily/${DATEFILE}/WindowsServer2008.vmx full
- # Take a 5 second break before doing the next step.
- sleep 5
- # Log actions.
- echo "Server clone for `date` completed." >>/backup/logs/backup_${DATEFILE}.log
- # Once VM is copied, resume the VM.
- vmrun start /home/bpcomp/vmware/WindowsServer2008/Windows\ Server\ 2008.vmx
- # Log actions.
- echo "Server resumed `date`." >>/backup/logs/backup_${DATEFILE}.log
- echo "Backup completed." >>/backup/logs/backup_${DATEFILE}.log
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement