From 6dd2433b20149b4951cb4c9803d83df372d60ccc Mon Sep 17 00:00:00 2001 From: Anthony Date: Fri, 18 Jul 2025 00:07:04 +0800 Subject: [PATCH] Fix directory /data/backups --- changelogs.md | 2 +- manifest.jps | 2 +- readme.md | 2 +- scripts/backup-logic.sh | 2 +- scripts/backup-main.js | 2 +- scripts/imports/backup_core_files.sh | 2 +- scripts/imports/backup_database.sh | 2 +- scripts/imports/backup_media.sh | 4 ++-- scripts/imports/check_backup_repo.sh | 2 +- scripts/imports/check_repo_stats.sh | 2 +- scripts/imports/restore_backup_direct.sh | 2 +- scripts/imports/restore_full_backup_session.sh | 2 +- scripts/imports/view_backup_sessions.sh | 2 +- scripts/imports/view_snapshots.sh | 2 +- scripts/install-restic.sh | 8 ++++---- scripts/mb-backup-manager.js | 8 ++++---- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/changelogs.md b/changelogs.md index 2c65a89..77d099f 100644 --- a/changelogs.md +++ b/changelogs.md @@ -14,7 +14,7 @@ ### Fixed - Resolved issues with fetching available tags when no snapshots existed in the repository, ensuring consistent script behavior. -- Fixed a missing password issue when executing `restic -r /mnt/backups snapshots --json`, ensuring `RESTIC_PASSWORD` is securely passed in all cases. +- Fixed a missing password issue when executing `restic -r /data/backups snapshots --json`, ensuring `RESTIC_PASSWORD` is securely passed in all cases. - Corrected formatting and display of available tags to ensure no duplicate or unnecessary entries are shown. ### Updated diff --git a/manifest.jps b/manifest.jps index d85ef27..835f288 100644 --- a/manifest.jps +++ b/manifest.jps @@ -383,7 +383,7 @@ actions: # Remove script directory - rm -rf "${globals.scriptPath}" # Remove backup repository completely - - rm -rf /mnt/backups + - rm -rf /data/backups # Remove password file - rm -f /etc/restic-password # Remove log rotation config diff --git a/readme.md b/readme.md index fb0c533..000ea51 100644 --- a/readme.md +++ b/readme.md @@ -280,7 +280,7 @@ Displays current backup-related cron jobs and automation status. The following environment variables are used by the scripts: - `RESTIC_PASSWORD`: Stored in `/etc/restic-password` -- `RESTIC_REPOSITORY`: Default path `/mnt/backup` +- `RESTIC_REPOSITORY`: Default path `/data/backups` ### Log File Locations diff --git a/scripts/backup-logic.sh b/scripts/backup-logic.sh index 5e77c7d..0218bbe 100644 --- a/scripts/backup-logic.sh +++ b/scripts/backup-logic.sh @@ -15,7 +15,7 @@ COMMAND="$2" # Set dynamic configurations based on ENV_NAME LOG_FILE="/var/log/${ENV_NAME}_backup_script.log" -BACKUP_REPO_PATH="/mnt/backups/${ENV_NAME}" +BACKUP_REPO_PATH="/data/backups/${ENV_NAME}" PASSWORD_FILE="/etc/restic-password" LOCK_FILE="/tmp/restic_global.lock" diff --git a/scripts/backup-main.js b/scripts/backup-main.js index 3050408..2161606 100644 --- a/scripts/backup-main.js +++ b/scripts/backup-main.js @@ -13,7 +13,7 @@ function run() { envName : "${envName}", envAppid : "${envAppid}", backupCount : "${backupCount}", - backupPath : "/mnt/backup" + backupPath : "/data/backups" }); api.local.ReturnResult( diff --git a/scripts/imports/backup_core_files.sh b/scripts/imports/backup_core_files.sh index 4fb2352..f5ffe40 100644 --- a/scripts/imports/backup_core_files.sh +++ b/scripts/imports/backup_core_files.sh @@ -22,7 +22,7 @@ CUSTOM_LABEL="$2" # Configuration APP_PATH="/var/www/webroot/ROOT" -BACKUP_PATH="/mnt/backups" +BACKUP_PATH="/data/backups" PASSWORD_FILE="/etc/restic-password" LOG_DIR="/home/jelastic/mb-backups/logs" LOG_FILE="${LOG_DIR}/backup_core_files_$(date +'%Y-%m-%d').log" diff --git a/scripts/imports/backup_database.sh b/scripts/imports/backup_database.sh index 532a872..abf4536 100644 --- a/scripts/imports/backup_database.sh +++ b/scripts/imports/backup_database.sh @@ -16,7 +16,7 @@ CUSTOM_TAG="$2" # Configuration APP_PATH='/var/www/webroot/ROOT' WP_CONFIG="${APP_PATH}/wp-config.php" -BACKUP_PATH='/mnt/backups' +BACKUP_PATH='/data/backups' PASSWORD_FILE="/etc/restic-password" LOG_DIR="/home/jelastic/mb-backups/logs" LOG_FILE="${LOG_DIR}/backup_database_$(date +'%Y-%m-%d').log" diff --git a/scripts/imports/backup_media.sh b/scripts/imports/backup_media.sh index 2816f69..5d0f5a7 100644 --- a/scripts/imports/backup_media.sh +++ b/scripts/imports/backup_media.sh @@ -15,7 +15,7 @@ CUSTOM_TAG="$2" # Configuration APP_PATH='/var/www/webroot/ROOT' -BACKUP_PATH='/mnt/backups' +BACKUP_PATH='/data/backups' PASSWORD_FILE="/etc/restic-password" LOG_DIR="/home/jelastic/mb-backups/logs/manual/media" LOG_FILE="${LOG_DIR}/backup_media_$(date +'%Y-%m-%d').log" @@ -66,7 +66,7 @@ else log "No stale locks found." fi -# Check and fix permissions on /mnt/backups +# Check and fix permissions on /data/backups if [ ! -w "$BACKUP_PATH/locks" ]; then log "Fixing permissions on $BACKUP_PATH/locks" sudo chown -R litespeed:litespeed "$BACKUP_PATH/locks" diff --git a/scripts/imports/check_backup_repo.sh b/scripts/imports/check_backup_repo.sh index 2d08e29..361e84d 100644 --- a/scripts/imports/check_backup_repo.sh +++ b/scripts/imports/check_backup_repo.sh @@ -4,7 +4,7 @@ set -e # Configuration -BACKUP_REPO_PATH="/mnt/backups" +BACKUP_REPO_PATH="/data/backups" PASSWORD_FILE="/etc/restic-password" LOG_FILE="/var/log/backup_repo_check.log" diff --git a/scripts/imports/check_repo_stats.sh b/scripts/imports/check_repo_stats.sh index 7fe2505..e3f75f3 100644 --- a/scripts/imports/check_repo_stats.sh +++ b/scripts/imports/check_repo_stats.sh @@ -4,7 +4,7 @@ set -e # Configuration -BACKUP_REPO_PATH="/mnt/backups" +BACKUP_REPO_PATH="/data/backups" PASSWORD_FILE="/etc/restic-password" LOG_DIR="/home/litespeed/mb-backups/logs" LOG_FILE="${LOG_DIR}/repo_stats_$(date +'%Y-%m-%d').log" diff --git a/scripts/imports/restore_backup_direct.sh b/scripts/imports/restore_backup_direct.sh index 91d8c6f..b8cd342 100644 --- a/scripts/imports/restore_backup_direct.sh +++ b/scripts/imports/restore_backup_direct.sh @@ -13,7 +13,7 @@ fi # Assign input to variables SNAPSHOT_ID=$1 RESTIC_PASSWORD_FILE="/etc/restic-password" -RESTIC_REPOSITORY="/mnt/backups" +RESTIC_REPOSITORY="/data/backups" LOG_DIR="/home/jelastic/mb-backups/logs/restore" WP_CONFIG="/var/www/webroot/ROOT/wp-config.php" diff --git a/scripts/imports/restore_full_backup_session.sh b/scripts/imports/restore_full_backup_session.sh index a9e240f..064574b 100644 --- a/scripts/imports/restore_full_backup_session.sh +++ b/scripts/imports/restore_full_backup_session.sh @@ -18,7 +18,7 @@ fi # Assign input to variables BACKUP_SESSION_TAG="$1" RESTIC_PASSWORD_FILE="/etc/restic-password" -RESTIC_REPOSITORY="/mnt/backups" +RESTIC_REPOSITORY="/data/backups" LOG_DIR="/home/jelastic/mb-backups/logs/restore" WP_CONFIG="/var/www/webroot/ROOT/wp-config.php" TEMP_VALIDATION_DIR="/tmp/full_backup_validation_$$" diff --git a/scripts/imports/view_backup_sessions.sh b/scripts/imports/view_backup_sessions.sh index 8eca92a..08c5386 100644 --- a/scripts/imports/view_backup_sessions.sh +++ b/scripts/imports/view_backup_sessions.sh @@ -1,7 +1,7 @@ #!/bin/bash # Configuration -backupPath='/mnt/backups' +backupPath='/data/backups' password_file="/etc/restic-password" LOG_DIR="$HOME/mb-backups/logs" LOG_FILE="${LOG_DIR}/backup_sessions.log" diff --git a/scripts/imports/view_snapshots.sh b/scripts/imports/view_snapshots.sh index fe2be7c..e078e42 100644 --- a/scripts/imports/view_snapshots.sh +++ b/scripts/imports/view_snapshots.sh @@ -1,7 +1,7 @@ #!/bin/bash # Configuration -backupPath='/mnt/backups' +backupPath='/data/backups' password_file="/etc/restic-password" LOG_DIR="$HOME/mb-backups/logs" LOG_FILE="${LOG_DIR}/restic_snapshot.log" diff --git a/scripts/install-restic.sh b/scripts/install-restic.sh index 2216096..fbfe444 100644 --- a/scripts/install-restic.sh +++ b/scripts/install-restic.sh @@ -25,21 +25,21 @@ chmod 644 /etc/restic-password # Create directories echo "[INSTALL] Creating directories..." -mkdir -p /mnt/backups +mkdir -p /data/backups mkdir -p /home/litespeed/mb-backups/logs chmod -R 755 /home/litespeed/mb-backups/logs -chmod 755 /mnt/backups +chmod 755 /data/backups # Initialize repository echo "[INSTALL] Initializing repository..." export RESTIC_PASSWORD=$(cat /etc/restic-password) -export RESTIC_REPOSITORY=/mnt/backups +export RESTIC_REPOSITORY=/data/backups if restic snapshots >/dev/null 2>&1; then echo "[INSTALL] Repository already exists and is accessible" else echo "[INSTALL] Initializing new repository..." - rm -rf /mnt/backups/* 2>/dev/null || true + rm -rf /data/backups/* 2>/dev/null || true restic init echo "[INSTALL] Repository initialized successfully" fi diff --git a/scripts/mb-backup-manager.js b/scripts/mb-backup-manager.js index 26cf222..d4d6a91 100644 --- a/scripts/mb-backup-manager.js +++ b/scripts/mb-backup-manager.js @@ -106,7 +106,7 @@ function BackupManager(config) { backupType: backupType, session: session, email: user.email, - backupPath: "/mnt/backup" // Direct path to mounted backup storage + backupPath: "/data/backups" // Direct path to mounted backup storage }; return me.exec([ @@ -395,7 +395,7 @@ function BackupManager(config) { me.backup_wp_core = function () { var backupCallParams = { envName: config.envName, - backupPath: "/mnt/backup", // Direct path to mounted backup storage + backupPath: "/data/backups", // Direct path to mounted backup storage baseUrl: config.baseUrl, backupType: "wp_core", backupLogFile: "/var/log/backup_addon.log", @@ -414,7 +414,7 @@ function BackupManager(config) { me.backup_uploads = function () { var backupCallParams = { envName: config.envName, - backupPath: "/mnt/backup", // Direct path to mounted backup storage + backupPath: "/data/backups", // Direct path to mounted backup storage baseUrl: config.baseUrl, backupType: "wp_core", backupLogFile: "/var/log/backup_addon.log", @@ -433,7 +433,7 @@ function BackupManager(config) { me.backup_database = function () { var backupCallParams = { envName: config.envName, - backupPath: "/mnt/backup", // Direct path to mounted backup storage + backupPath: "/data/backups", // Direct path to mounted backup storage baseUrl: config.baseUrl, backupType: "wp_core", backupLogFile: "/var/log/backup_addon.log",