Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo =====================================
- echo `date` Backing up Documents
- # The URL to your remote AFP server. You can test your URL using command-K in the Finder.
- AFP_URL=afp://user:password@afp.server.com/Share
- # The place where the AFP server is mounted. By default this will be in /Volumes someplace.
- AFP_DIRECTORY=/Volumes/Share
- # A path relative to `AFP_DIRECTORY` where the encrypted disk image can be found. Create this yourself
- # with Disk Utility as an encrypted sparsebundle Disk Image. Be sure to make the maximum size large enough.
- IMAGE_PATH=backups/Backups.sparsebundle
- # The password you used when you create the disk image.
- IMAGE_PASSWORD=disk_image_password
- # Where the encrypted disk image is mounted when you open it in the Finder. Usually this will be somewhere in /Volumes.
- IMAGE_MOUNT_POINT=/Volumes/Backups
- # The directory you'd like to back up.
- BACKUP_DIRECTORY=/Users/koehn/Documents
- # Mount the remote AFP volume. We need to create the local directory where the mount will occur.
- mkdir -p "$AFP_DIRECTORY"
- mount_afp "$AFP_URL" "$AFP_DIRECTORY"
- # Mount the backup image. In this mode the user must enter the password on the command line.
- # Here we DON'T need to create the directory where the mount will occur. Go figure.
- echo -n "$IMAGE_PASSWORD" | hdiutil attach -stdinpass "$AFP_DIRECTORY/$IMAGE_PATH"
- # Backup the software to the remote encrypted volume using Apple's rsync 2.6.9 from 2006.
- # rsync -avE --exclude .DS_Store "$BACKUP_DIRECTORY" "$IMAGE_MOUNT_POINT"
- # Use this if you manually installed the (better) rsync 3.1.0 or later (limits bandwidth to 500KB/s)
- /usr/local/bin/rsync -aviAEX --bwlimit=500 --delete --exclude .DS_Store "$BACKUP_DIRECTORY" "$IMAGE_MOUNT_POINT"
- # Unmount the encrypted disk image.
- hdiutil detach "$IMAGE_MOUNT_POINT"
- # Unmount the remote directory (will delete the directory we crated with `mkdir` above).
- diskutil unmount "$AFP_DIRECTORY"
- echo `date` Done backing up Documents
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement