Files
BorgBackupWrapper/borg.backup.functions.info.sh

39 lines
1.0 KiB
Bash
Raw Normal View History

2021-12-13 10:36:44 +09:00
#!/usr/bin/env bash
# allow variables in printf format string
# shellcheck disable=SC2059
if [ -z "${MODULE}" ]; then
echo "Script cannot be run on its own";
exit 1;
fi;
if [ "${INFO}" -eq 1 ]; then
printf "${PRINTF_SUB_BLOCK}" "INFO" "$(date +'%F %T')" "${MODULE}";
2021-12-13 10:36:44 +09:00
# show command on debug or dry run
if [ "${DEBUG}" -eq 1 ] || [ "${DRYRUN}" -eq 1 ]; then
echo "export BORG_BASE_DIR=\"${BASE_FOLDER}\";${BORG_COMMAND} info ${OPT_REMOTE} ${REPOSITORY}";
2021-12-13 10:36:44 +09:00
fi;
# run info command if not a dry drun
if [ "${DRYRUN}" -eq 0 ]; then
${BORG_COMMAND} info ${OPT_REMOTE} "${REPOSITORY}";
2021-12-13 10:36:44 +09:00
fi;
if [ "${MODULE}" = "files" ]; then
if [ "${FOLDER_OK}" -eq 1 ]; then
2021-12-13 10:36:44 +09:00
echo "--- [Run command]:";
#IFS="#";
echo "export BORG_BASE_DIR=\"${BASE_FOLDER}\";${COMMAND} ${FOLDERS_Q[*]}";
2021-12-13 10:36:44 +09:00
else
echo "[!] No folders where set for the backup";
fi;
# remove the temporary exclude file if it exists
if [ -f "${TMP_EXCLUDE_FILE}" ]; then
rm -f "${TMP_EXCLUDE_FILE}";
fi;
fi;
. "${DIR}/borg.backup.functions.close.sh";
2021-12-13 10:36:44 +09:00
exit;
fi;
# __END__