Skip to content

BASH - Example Scripts for backing up a MacOS User Data and Apps to a Gzipped Tarball

License

Notifications You must be signed in to change notification settings

bonusbits/backup_macos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

BASH - Example Scripts for backing up a MacOS User Data and Apps to a Gzipped Tarball

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages