From f81e50c4303026f25749e925b8e3fbd7abb3df2a Mon Sep 17 00:00:00 2001 From: stumpyofpain <63201947+stumpyofpain@users.noreply.github.com> Date: Sat, 11 Oct 2025 17:20:06 +0200 Subject: [PATCH] host-backup.sh: Added "ALL" option and include timestamp in backup filename (#8276) * Update host-backup.sh added an "all" button to include all folders instead of clicking every folder by itself * Update host-backup.sh added a timestamp in the filename incase the user wants to make several backups on the same time. Otherweise the newest backup will overwrite the earlier one. --- tools/pve/host-backup.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/pve/host-backup.sh b/tools/pve/host-backup.sh index 5de60fc7e..662374af4 100644 --- a/tools/pve/host-backup.sh +++ b/tools/pve/host-backup.sh @@ -41,6 +41,7 @@ function perform_backup { # Build a list of directories for backup local CTID_MENU=() + CTID_MENU=("ALL" "Backup all folders" "OFF") while read -r dir; do CTID_MENU+=("$(basename "$dir")" "$dir " "OFF") done < <(ls -d "${DIR}"*) @@ -52,7 +53,13 @@ function perform_backup { "\nSelect what files/directories to backup:\n" 16 $(((${#DIRNAME} + 2) + 88)) 6 "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || return for selected_dir in ${HOST_BACKUP//\"/}; do - selected_directories+=("${DIR}$selected_dir") + if [[ "$selected_dir" == "ALL" ]]; then + # if ALL was chosen, secure all folders + selected_directories=("${DIR}"*/) + break + else + selected_directories+=("${DIR}$selected_dir") + fi done done @@ -62,7 +69,7 @@ function perform_backup { read -p "Press ENTER to continue..." header_info echo "Working..." - tar -czf "$BACKUP_PATH$BACKUP_FILE-$(date +%Y_%m_%d).tar.gz" --absolute-names "${selected_directories[@]}" + tar -czf "$BACKUP_PATH$BACKUP_FILE-$(date +%Y_%m_%dT%H_%M).tar.gz" --absolute-names "${selected_directories[@]}" header_info echo -e "\nFinished" echo -e "\e[1;33m \nA backup is rendered ineffective when it remains stored on the host.\n \e[0m"