From 414fbfcb81009e4462aa76dfb4535884c7a92aed Mon Sep 17 00:00:00 2001 From: Pau RE Date: Wed, 4 Sep 2024 09:54:18 +0200 Subject: [PATCH] Iterate inside folder backups Tries to fix #156 #157 --- backup.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/backup.sh b/backup.sh index fd3abb2..4a5066a 100755 --- a/backup.sh +++ b/backup.sh @@ -102,9 +102,16 @@ for DB in ${POSTGRES_DBS}; do MFILENEW="${MFILE}-new" rm -rf "${DFILENEW}" "${WFILENEW}" "${MFILENEW}" mkdir "${DFILENEW}" "${WFILENEW}" "${MFILENEW}" - ln -f "${FILE}/"* "${DFILENEW}/" - ln -f "${FILE}/"* "${WFILENEW}/" - ln -f "${FILE}/"* "${MFILENEW}/" + ( + # Allow to hardlink more files than max arg list length + # first CHDIR to avoid possible space problems with BACKUP_DIR + cd "${FILE}" + for F in *; do + ln -f "$F" "${DFILENEW}/" + ln -f "$F" "${WFILENEW}/" + ln -f "$F" "${MFILENEW}/" + done + ) rm -rf "${DFILE}" "${WFILE}" "${MFILE}" echo "Replacing daily backup ${DFILE} folder this last backup..." mv "${DFILENEW}" "${DFILE}"