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
|
2018-12-10 02:05:58 -05:00
|
|
|
case $1 in
|
|
|
|
|
nzxt )
|
2019-05-02 23:05:54 -04:00
|
|
|
backup_dest="$mount_dir/nzxt"
|
2018-12-20 01:57:47 -05:00
|
|
|
# backup_dest="$mount_dir/backup-usb/nzxt"
|
2018-12-10 02:05:58 -05:00
|
|
|
;;
|
2024-03-20 15:08:00 -04:00
|
|
|
arch-2 )
|
|
|
|
|
backup_dest="$mount_dir/arch-2"
|
|
|
|
|
# backup_dest="$mount_dir/backup-usb/nzxt"
|
|
|
|
|
;;
|
2018-12-10 02:05:58 -05:00
|
|
|
x1 )
|
2019-05-02 23:05:54 -04:00
|
|
|
backup_dest="$mount_dir/laptop"
|
2018-12-10 02:05:58 -05:00
|
|
|
;;
|
|
|
|
|
esac
|
2019-05-02 23:05:54 -04:00
|
|
|
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
|
2019-07-08 03:22:24 -04:00
|
|
|
tar-root )
|
2018-12-20 01:57:47 -05:00
|
|
|
# Labels for backup name
|
|
|
|
|
distro="arch"
|
|
|
|
|
datetime=$(date "+%m.%d-%H.%M")
|
2019-07-08 03:22:24 -04:00
|
|
|
backup_file="$backup_dest/tar/$datetime-$distro-root.tar.gz"
|
2018-12-03 15:55:51 -05:00
|
|
|
|
2019-07-08 03:22:24 -04: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"
|
|
|
|
|
# ;;
|
2019-07-08 03:22:24 -04:00
|
|
|
home )
|
|
|
|
|
sudo rsync -PraAX --exclude-from="$exclude_dirs_list_full" /home "$backup_dest/full"
|
2018-12-20 01:57:47 -05:00
|
|
|
esac
|