mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 06:40:13 -08:00
- Created a base HTML template for consistent layout across pages. - Developed a dashboard page to display backup service metrics and statuses. - Implemented a log viewer for detailed log file inspection. - Added error handling page for better user experience during failures. - Introduced service detail page to show specific service metrics and actions. - Enhanced log filtering and viewing capabilities. - Integrated auto-refresh functionality for real-time updates on metrics. - Created integration and unit test scripts for backup metrics functionality.
46 lines
1.8 KiB
Bash
Executable File
46 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Setup Local Backup Environment
|
|
# Creates a local backup directory structure for testing the web dashboard
|
|
|
|
BACKUP_BASE_DIR="$HOME/shell-backups"
|
|
METRICS_DIR="$BACKUP_BASE_DIR/metrics"
|
|
|
|
echo "Setting up local backup environment at: $BACKUP_BASE_DIR"
|
|
|
|
# Create directory structure
|
|
mkdir -p "$BACKUP_BASE_DIR"/{plex,immich,media-services}/{scheduled,manual}
|
|
mkdir -p "$METRICS_DIR"
|
|
|
|
# Copy existing metrics files if they exist
|
|
if [[ -d "/home/acedanger/shell/metrics" ]]; then
|
|
cp /home/acedanger/shell/metrics/*.json "$METRICS_DIR/" 2>/dev/null || true
|
|
fi
|
|
|
|
# Create sample backup files with realistic names and sizes
|
|
echo "Creating sample backup files..."
|
|
|
|
# Plex backups
|
|
echo "Sample Plex database backup content" > "$BACKUP_BASE_DIR/plex/scheduled/plex-db-backup-$(date +%Y%m%d-%H%M%S).tar.gz"
|
|
echo "Sample Plex config backup content" > "$BACKUP_BASE_DIR/plex/manual/plex-config-$(date +%Y%m%d).zip"
|
|
|
|
# Immich backups
|
|
echo "Sample Immich database dump" > "$BACKUP_BASE_DIR/immich/immich-database-$(date +%Y%m%d).sql"
|
|
echo "Sample Immich assets backup" > "$BACKUP_BASE_DIR/immich/scheduled/immich-assets-$(date +%Y%m%d).tar.gz"
|
|
|
|
# Media services backups
|
|
echo "Sample media services configuration" > "$BACKUP_BASE_DIR/media-services/media-services-config-$(date +%Y%m%d).json"
|
|
|
|
# Make files larger to simulate real backups (optional)
|
|
if command -v fallocate >/dev/null 2>&1; then
|
|
fallocate -l 1M "$BACKUP_BASE_DIR/plex/scheduled/plex-db-backup-$(date +%Y%m%d-%H%M%S).tar.gz"
|
|
fallocate -l 500K "$BACKUP_BASE_DIR/immich/immich-database-$(date +%Y%m%d).sql"
|
|
fi
|
|
|
|
echo "Local backup environment setup complete!"
|
|
echo "Backup directory: $BACKUP_BASE_DIR"
|
|
echo "To use with web app: export BACKUP_ROOT=\"$BACKUP_BASE_DIR\""
|
|
echo ""
|
|
echo "Contents:"
|
|
find "$BACKUP_BASE_DIR" -type f | head -10
|