Created
November 15, 2021 17:51
-
-
Save R3M4G/39500fac48434564b18ba0350dea2914 to your computer and use it in GitHub Desktop.
template for my tar backup script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################ | |
# | |
# Backup Script | |
# | |
############################ | |
# Source | |
source_files="/dir" | |
# Destination | |
dest="/dir" | |
# Archive details | |
day=$(date +%A) | |
hostname=$(hostname -s) | |
archive_file="$hostname-$day.tgz" | |
# Print info | |
echo "Backing up $source_files to $dest" | |
date | |
echo | |
# Backup | |
tar czf $dest/$archive_file $source_files | |
# End | |
echo | |
echo "Done" | |
date | |
# Long listing of files in $dest to check file sizes. | |
ls -lh $dest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment