This project contains a shell script for backing up a macOS home directory. It is designed to be run on a personal macOS laptop.
- Dynamic Date Handling: Automatically names backup files with the current date and time to avoid overwrites.
- Configurable Exclusions: Uses an external configuration file for specifying directories to exclude from the backup.
- Detailed Logging: Outputs a detailed log file for each backup operation.
- Error Handling: Catches errors during the backup process and logs them.
- Backup Verification: Verifies the integrity of the backup after creation.
To use this script:
- Clone this repository to your local machine.
- Copy the
backup_exclude.conf.example
intobackup_exclude.conf
- Customize the
backup_exclude.conf
with paths you want to exclude from the backup. - Set the
backup_dest
variable in the script to your desired backup location. - Run the script manually with
./backup_script.sh
, or set it up as a cron job for automatic execution.
- macOS environment.
- Sufficient permissions to access and create files in the backup and log directories.
- tar utility (should be pre-installed on macOS).
Create backup_exclude.conf
in the same directory as the script, or in a location of your choice
(updating the config_file
variable in the script accordingly), with contents like the following:
/Users/yourusername/.Trash
/Users/yourusername/projects/big_project
/Users/yourusername/Downloads
# Add more lines as needed
Replace /Users/yourusername
with the appropriate path to your home directory.
The backup archive will be saved to the path specified in backup_dest
.
A log file for each backup operation will be saved to the same directory as the backup file.
Contributions to this project are welcome! Please fork the repository, make your changes, and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.