Software/Sovran_SystemsOS_External_Backup/External Backup Source Files/Sovran_SystemsOS_External_Backup.sh

65 lines
1.6 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
CHOOSE () {
file=$(zenity --file-selection --directory --title="Sovran_SystemsOS External Backup - CHOOSE BACKUP LOCATION")
2024-03-13 17:36:06 -07:00
if [[ $? -eq 1 ]]; then
exit 1
fi
}
SAGE () {
time_stamp=$(date +%Y-%m-%d-%T)
mkdir -p /home/free/Documents/External_Backup_Logs
2024-03-18 23:24:38 -07:00
if ! ssh root@localhost rsync -avr /run/media/Second_Drive/BTCEcoandBackup/NixOS_Snapshot_Backup/hourly.0 /"$file"/"$time_stamp" 2>&1 | tee /home/free/Documents/External_Backup_Logs/"$time_stamp"_External_Backup_Log.txt; then
zenity --error \
--width=500 \
--title="Sovran_SystemsOS External Backup" \
--text="Error Could Not Backup."
else
zenity --info \
--ellipsize \
--no-wrap \
--width=700 \
--title="Sovran_SystemsOS External Backup" \
--text="All Finished! Please eject the external drive before removing it from your Sovran Pro."
fi
}
#########
2024-03-13 17:33:15 -07:00
curl "https://git.sovransystems.com/Sovran_Systems/Software/raw/branch/main/Sovran_SystemsOS_External_Backup/External%20Backup%20Source%20Files/Intro.md" |
zenity --text-info \
--width=1000 \
2024-03-18 23:26:55 -07:00
--height=700 \
--title="Sovran_SystemsOS External Backup"
if [[ $? -eq 1 ]]; then
exit 1
else
CHOOSE
2024-03-18 23:26:55 -07:00
SAGE | zenity --progress --no-cancel --auto-close --width=1100 --pulsate --text="Backing up now. It could take up to 4 hours for it to finish depending on the amount of data stored on your Sovran Pro and the speed of your external hard drive. Be patient..." --title="Sovran_SystemsOS External Backup"
2024-03-18 23:20:03 -07:00
find /home/free/Documents/External_Backup_Logs -name "*.txt" -type f -mtime +3 -delete
fi
2024-03-18 23:20:03 -07:00
exit 0