Utilizing a Git repository as the backup destination is recommended, and you may consider using GitHub as well.
Considering the potential growth of the .git
folder, this script will only retain the latest commit.
Please pay attention to the following points:
- The backup repository should be located at
/home/$backup_dir
.- Ensure that the
backup_dir
variable in the script corresponds to the actual directory, without appending a "/" at the end. - Prior to running the script, configure the necessary information for the
backup_dir
Git repository, including user, email, and login credentials.
- Ensure that the
- The default branch for the repository should be named "master".
- Modify the
input_dir
variable in the script according to your requirements, indicating the folder that needs to be backed up. - The
outputfile
variable refers to the resulting tarball backup file.- To overcome GitHub's 100MB file size restriction, the resulting tarball will be split into chunks of approximately 90MB each before uploading.
- If your system's got a very terrible network so that git push fails, try:
git config --global http.postBuffer 524288000