generated from john/python-template
This commit is contained in:
@@ -16,6 +16,8 @@ logs_file="logs-${timestamp}.tar.gz"
|
||||
manifest_file="backup-${timestamp}.manifest"
|
||||
|
||||
mkdir -p "${BACKUP_DIR}"
|
||||
mkdir -p "${APP_DATA_BACKUP_DIR}"
|
||||
app_data_backup_abs="$(cd "${APP_DATA_BACKUP_DIR}" && pwd -P)"
|
||||
|
||||
# If SYNOLOGY_BACKUP_DIR wasn't exported in the shell, read it from ENV_FILE.
|
||||
if [ -z "${SYNOLOGY_BACKUP_DIR}" ] && [ -f "${ENV_FILE}" ]; then
|
||||
@@ -68,10 +70,17 @@ find "${BACKUP_DIR}" -type f \( \
|
||||
-name 'backup-*.manifest' \
|
||||
\) -mtime +"${RETENTION_DAYS}" -delete
|
||||
|
||||
# Always keep a rolling incremental mirror of uploaded files in BACKUP_DIR.
|
||||
mkdir -p "${APP_DATA_BACKUP_DIR}"
|
||||
# Always keep a rolling mirror of app data in BACKUP_DIR, unless that target
|
||||
# is nested under /app/data (which would recursively copy into itself).
|
||||
if [ -d /app/data ]; then
|
||||
cp -a /app/data/. "${APP_DATA_BACKUP_DIR}/"
|
||||
case "${app_data_backup_abs}" in
|
||||
/app/data|/app/data/*)
|
||||
echo "Skipping app data mirror because APP_DATA_BACKUP_DIR is nested under /app/data: ${APP_DATA_BACKUP_DIR}"
|
||||
;;
|
||||
*)
|
||||
cp -a /app/data/. "${APP_DATA_BACKUP_DIR}/"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
mkdir -p "${UPLOADS_BACKUP_DIR}/documents" "${UPLOADS_BACKUP_DIR}/photos"
|
||||
|
||||
Reference in New Issue
Block a user