Skip to content

Latest commit

 

History

History
68 lines (60 loc) · 1.86 KB

README.md

File metadata and controls

68 lines (60 loc) · 1.86 KB

Backup MacOS Scripts

A BASH script to backup a single user home directory, or installed apps or user home dot files.

Prerequisites

  • tee command
    • Should be pre-installed on MacOS

Setup

  1. Clone to system from Github.

git clone https://github.com/bonusbits/backup_macos.git ~/git/ 2. Make script executable

sudo chmod +x ~/git/backup_macos/*.sh 3. Create Symlink and aliases for shell Scripts in bash profile

# Backup Scripts
if [ ! -h "/usr/local/bin/backup_macos" ]; then
   ln -s "/path/to/clone/backup_macos/backup.sh" /usr/local/bin/backup_macos
fi
# Examples
alias backupjoe="sudo backup_macos -b user -u jdoe -d /Volumes/usbdrive/Backups -r 60 -m 500000"
alias backupapps="sudo backup_macos -b apps -d /Volumes/usbdrive/Backups/ -r 60 -m 300000"
alias backupapps="sudo backup_macos -b dot -d /Volumes/usbdrive/Backups/ -r 60 -m 10000"

Parameters: backup_macos_user.sh

Option Description
-b Backup Type. [user|dot|apps] (Required)
-u Username or home folder name to backup. (Required - IF user type selected)
-d Destination backup folder. (Required)
-m Max Space in Megabits. How much maximum space to allow in the destination directory. Default: (250000MB)
-r Retention Days. How long to keep backups in the destination directory. Default: (14)
-h Display Help
-v Display Version

Examples

  • sudo backup_macos_user.sh -u jdoe -d /Volumes/usbdrive/Backups
  • sudo backup_macos_user.sh -u jdoe -d /Volumes/usbdrive/Backups -r 60 -m 500000