mirror of
https://github.com/acedanger/shell.git
synced 2025-12-05 22:50:18 -08:00
feat: Add NAS mount check and setup script for improved backup reliability
This commit is contained in:
@@ -125,7 +125,7 @@ declare -A MEDIA_SERVICES=(
|
||||
["tautulli"]="/config/backups"
|
||||
["sabnzbd"]="/config/sabnzbd.ini"
|
||||
["jellyseerr_db"]="/config/db/"
|
||||
["jellyseerr_settings"]="/config/settings.json"
|
||||
["jellyseerr_settings"]="/data/settings.json"
|
||||
)
|
||||
|
||||
# Service-specific backup destinations
|
||||
@@ -181,6 +181,28 @@ log_info() {
|
||||
echo "[${timestamp}] INFO: $message" >> "${LOG_FILE}" 2>/dev/null || true
|
||||
}
|
||||
|
||||
# Check if NAS mount is accessible
|
||||
check_nas_mount() {
|
||||
local mount_point="/mnt/share/media"
|
||||
|
||||
if ! mountpoint -q "$mount_point"; then
|
||||
log_error "NAS not mounted at $mount_point"
|
||||
log_info "Please mount the NAS first with: sudo mount $mount_point"
|
||||
log_info "Or check the mounting setup guide in docs/nas-mount-setup-guide.md"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Test write access to backup directory
|
||||
if [ ! -w "$BACKUP_ROOT" ]; then
|
||||
log_error "No write access to backup directory: $BACKUP_ROOT"
|
||||
log_info "Check NAS mount permissions and credentials"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_success "NAS mount check passed: $mount_point is accessible"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Performance tracking functions
|
||||
track_performance() {
|
||||
if [ "$PERFORMANCE_MONITORING" != true ]; then
|
||||
@@ -689,6 +711,14 @@ main() {
|
||||
fi
|
||||
|
||||
# Pre-flight checks
|
||||
if ! check_nas_mount; then
|
||||
if [[ "$METRICS_ENABLED" == "true" ]]; then
|
||||
metrics_backup_complete "failed" "NAS mount not accessible"
|
||||
fi
|
||||
send_notification "Media Backup Failed" "NAS mount not accessible at $MOUNT_POINT" "error" 0 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! check_disk_space; then
|
||||
if [[ "$METRICS_ENABLED" == "true" ]]; then
|
||||
metrics_backup_complete "failed" "Insufficient disk space"
|
||||
@@ -707,6 +737,15 @@ main() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if NAS mount is accessible
|
||||
if ! check_nas_mount; then
|
||||
if [[ "$METRICS_ENABLED" == "true" ]]; then
|
||||
metrics_backup_complete "failed" "NAS mount not accessible"
|
||||
fi
|
||||
send_notification "Media Backup Failed" "NAS mount not accessible" "error" 0 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local success_count=0
|
||||
local failed_count=0
|
||||
local backup_results=()
|
||||
|
||||
Reference in New Issue
Block a user