Files
linux-config/scripts/executable_backup-pc

37 lines
946 B
Plaintext
Raw Permalink Normal View History

2018-12-03 15:55:51 -05:00
#!/bin/bash
2023-10-05 14:55:26 -04:00
# mount_dir="/run/media/kevin/backup-hd"
mount_dir="/mnt/linux-files-2"
2018-12-03 15:55:51 -05:00
# Backup destination
case $1 in
nzxt )
backup_dest="$mount_dir/nzxt"
2018-12-20 01:57:47 -05:00
# backup_dest="$mount_dir/backup-usb/nzxt"
;;
2024-03-20 15:08:00 -04:00
arch-2 )
backup_dest="$mount_dir/arch-2"
# backup_dest="$mount_dir/backup-usb/nzxt"
;;
x1 )
backup_dest="$mount_dir/laptop"
;;
esac
exclude_dirs_list="/home/kevin/txt/exclude-dirs-backup.txt"
exclude_dirs_list_full="/home/kevin/txt/exclude-dirs-backup-full.txt"
2018-12-03 15:55:51 -05:00
2018-12-20 01:57:47 -05:00
case $2 in
tar-root )
2018-12-20 01:57:47 -05:00
# Labels for backup name
distro="arch"
datetime=$(date "+%m.%d-%H.%M")
backup_file="$backup_dest/tar/$datetime-$distro-root.tar.gz"
2018-12-03 15:55:51 -05:00
sudo tar -czpvf "$backup_file" --exclude-from="$exclude_dirs_list" --exclude=/home /
2018-12-20 01:57:47 -05:00
;;
2019-10-07 22:46:08 -04:00
# full )
# sudo rsync -PraAX --exclude-from="$exclude_dirs_list_full" / "$backup_dest/full"
# ;;
home )
sudo rsync -PraAX --exclude-from="$exclude_dirs_list_full" /home "$backup_dest/full"
2018-12-20 01:57:47 -05:00
esac