Skip to content

Instantly share code, notes, and snippets.

@ethand91
Created March 28, 2022 06:31
Show Gist options
  • Save ethand91/d164602f1c298178cfb2b51894045a61 to your computer and use it in GitHub Desktop.
Save ethand91/d164602f1c298178cfb2b51894045a61 to your computer and use it in GitHub Desktop.
Script that backs up directories to an external device.
#!/bin/bash
# Script to backup directories to external disk
backup_files="/home /etc /root /boot /opt"
backup_location="/mnt/backup"
# Create the filename
day=$(date +%A)
file_name="backup-$day.tgz"
tar -Pczf $backup_location/$file_name $backup_files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment