Skip to content

Instantly share code, notes, and snippets.

@Xeckt
Created February 3, 2021 11:52
Show Gist options
  • Save Xeckt/6d7b210bc6887e0daf523fee41bd490b to your computer and use it in GitHub Desktop.
Save Xeckt/6d7b210bc6887e0daf523fee41bd490b to your computer and use it in GitHub Desktop.
Bash backup
function backup_files() {
_backup_file="template-backup-["`date +"%Y-%m-%d-%m"`"].tar.gz"
echo 'Creating backup of:' $(pwd)
tar -czf $HOME/$_backup_file . &>> install/install.log
if [ $? -eq 0 ]; then
echo 'Backup seems to be successful.'
else
echo 'Something went wrong, exit code:' $?
echo 'Check ....'
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment