borg2-list-backups.sh: Add support for running script om backup host.

This commit is contained in:
Christoph 2025-01-01 14:19:47 +01:00
parent 20355bacae
commit 3b1dd2d30f

View File

@ -225,10 +225,12 @@ DEFAULT_BORG_RSH='ssh -i /root/.ssh/id_ed25519-borg-backup'
# ---------- # ----------
if [[ -f "$conf_file" ]]; then if [[ -z "${BORG_HOST}" ]] || [[ -z "${BORG_REPO}" ]] || [[ -z "${BORG_PASSPHRASE}" ]] ; then
if [[ -f "$conf_file" ]]; then
source "$conf_file" source "$conf_file"
else else
fatal "No configuration file '$conf_file' present!" fatal "No configuration file '$conf_file' present!"
fi
fi fi
@ -278,10 +280,20 @@ export BORG_RELOCATED_REPO_ACCESS_IS_OK
echo -e " \033[1mDate\033[33GBorg Backup ID\033[m\n" echo -e " \033[1mDate\033[33GBorg Backup ID\033[m\n"
while read -r _borg_id _date_weekday _date_date _date_time _time_stamp_borg_backup || [[ -n $_line ]] ; do if [[ ${BORG_HOST} =~ ^127 ]] || [[ "${BORG_HOST,,}" =~ "localhost" ]] ; then
while read -r _borg_id _date_weekday _date_date _date_time _time_stamp_borg_backup || [[ -n $_line ]] ; do
echo -e " ${_date_weekday} ${_date_date} ${_date_time} [ \033[33m${_borg_id}\033[m ]" echo -e " ${_date_weekday} ${_date_date} ${_date_time} [ \033[33m${_borg_id}\033[m ]"
done < <(borg2 --remote-path borg2 --repo ${BORG_URL} rlist) done < <(borg2 --remote-path borg2 --repo ${BORG_REPO} rlist)
else
while read -r _borg_id _date_weekday _date_date _date_time _time_stamp_borg_backup || [[ -n $_line ]] ; do
echo -e " ${_date_weekday} ${_date_date} ${_date_time} [ \033[33m${_borg_id}\033[m ]"
done < <(borg2 --remote-path borg2 --repo ${BORG_URL} rlist)
fi
clean_up 0 clean_up 0