Add comprehensive Acronis backup management interface
Implemented complete backup management section with acrocmd integration: New Features: - Backup Manager: Centralized interface with organized sections • Agent Management (status, logs) • Backup Operations (list, trigger, status) • Plan Management (view, manage protection plans) • Restore Operations (placeholder for future) Scripts Created: - acronis-backup-manager.sh: Main backup management menu - acronis-list-backups.sh: Lists archives and backup details - acronis-trigger-backup.sh: Triggers manual backups with plan selection - acronis-backup-status.sh: Shows active tasks and recent activities - acronis-schedule-viewer.sh: Displays protection plans and schedules - acronis-plan-manager.sh: Manages protection plans (view/enable/disable/delete) Integration: - All scripts use acrocmd CLI for programmatic backup operations - Updated Acronis menu with streamlined "Manage Backups" option - Reorganized menu structure for better usability - Added proper error handling and status checks 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Executable
+183
@@ -0,0 +1,183 @@
|
||||
#!/bin/bash
|
||||
|
||||
################################################################################
|
||||
# Acronis Trigger Backup
|
||||
################################################################################
|
||||
# Purpose: Trigger manual backups using acrocmd
|
||||
# Features:
|
||||
# - List available backup plans
|
||||
# - Run backup for specific plan
|
||||
# - Trigger ad-hoc backup
|
||||
################################################################################
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
source "$SCRIPT_DIR/lib/common-functions.sh"
|
||||
source "$SCRIPT_DIR/lib/system-detect.sh"
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
print_error "This script must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
clear
|
||||
print_banner "Trigger Manual Backup"
|
||||
|
||||
echo ""
|
||||
|
||||
# Check if acrocmd is available
|
||||
if [ ! -f "/usr/sbin/acrocmd" ]; then
|
||||
print_error "acrocmd command-line tool not found"
|
||||
echo ""
|
||||
press_enter
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# List available plans
|
||||
echo -e "${BOLD}Available Backup Plans${NC}"
|
||||
echo ""
|
||||
echo "Querying backup plans from Acronis..."
|
||||
echo ""
|
||||
|
||||
plan_output=$(/usr/sbin/acrocmd list plans 2>&1)
|
||||
|
||||
if echo "$plan_output" | grep -qi "error\|failed\|no plans"; then
|
||||
echo -e "${YELLOW}No backup plans found or error querying plans${NC}"
|
||||
echo ""
|
||||
echo "Possible reasons:"
|
||||
echo " • No backup plans configured yet"
|
||||
echo " • Agent not registered with Acronis Cloud"
|
||||
echo " • Need to configure plans in web console first"
|
||||
echo ""
|
||||
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
|
||||
echo ""
|
||||
echo -e "${BOLD}To Configure Backup Plans:${NC}"
|
||||
echo ""
|
||||
echo "1. Log in to Acronis web console"
|
||||
echo "2. Navigate to: Devices → Select this server"
|
||||
echo "3. Click 'Add protection plan'"
|
||||
echo "4. Configure backup settings and schedule"
|
||||
echo "5. Return here to trigger backups"
|
||||
echo ""
|
||||
press_enter
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "$plan_output"
|
||||
echo ""
|
||||
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
|
||||
echo ""
|
||||
echo -e "${BOLD}Trigger Backup Options:${NC}"
|
||||
echo ""
|
||||
echo " 1) Run backup for specific plan (by ID)"
|
||||
echo " 2) Run all protection plans"
|
||||
echo " 3) Web console method (recommended)"
|
||||
echo " 0) Cancel"
|
||||
echo ""
|
||||
echo -n "Select option [3]: "
|
||||
read -r choice
|
||||
choice="${choice:-3}"
|
||||
|
||||
case "$choice" in
|
||||
1)
|
||||
echo ""
|
||||
echo -n "Enter plan ID (or name) from list above: "
|
||||
read -r plan_id
|
||||
|
||||
if [ -z "$plan_id" ]; then
|
||||
print_error "Plan ID/name required"
|
||||
press_enter
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${BOLD}Starting Backup...${NC}"
|
||||
echo ""
|
||||
echo "Triggering backup for plan: $plan_id"
|
||||
echo ""
|
||||
|
||||
# Try to run backup
|
||||
if /usr/sbin/acrocmd backup run --plan "$plan_id" 2>&1; then
|
||||
echo ""
|
||||
print_success "Backup initiated successfully"
|
||||
echo ""
|
||||
echo "Monitor progress with 'Check Backup Status'"
|
||||
else
|
||||
echo ""
|
||||
print_error "Failed to start backup"
|
||||
echo ""
|
||||
echo "Check that:"
|
||||
echo " • Plan ID/name is correct"
|
||||
echo " • Agent is online and registered"
|
||||
echo " • No conflicting backups running"
|
||||
fi
|
||||
;;
|
||||
|
||||
2)
|
||||
echo ""
|
||||
echo -e "${BOLD}Running All Protection Plans${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}Warning:${NC} This will trigger backups for ALL configured plans."
|
||||
echo ""
|
||||
echo -n "Continue? (yes/no): "
|
||||
read -r confirm
|
||||
|
||||
if [[ ! "$confirm" =~ ^[Yy]([Ee][Ss])?$ ]]; then
|
||||
echo ""
|
||||
echo "Cancelled"
|
||||
press_enter
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Triggering all protection plans..."
|
||||
echo ""
|
||||
|
||||
if /usr/sbin/acrocmd backup run --all 2>&1; then
|
||||
echo ""
|
||||
print_success "All backups initiated"
|
||||
echo ""
|
||||
echo "Monitor progress with 'Check Backup Status'"
|
||||
else
|
||||
echo ""
|
||||
print_error "Failed to start backups"
|
||||
fi
|
||||
;;
|
||||
|
||||
3)
|
||||
# Web console method
|
||||
echo ""
|
||||
echo -e "${BOLD}Web Console Method${NC}"
|
||||
echo ""
|
||||
echo "Steps to trigger backup via web console:"
|
||||
echo ""
|
||||
echo "1. Log in to Acronis web console"
|
||||
|
||||
# Try to get cloud URL
|
||||
if [ -f "/etc/Acronis/Global.config" ]; then
|
||||
cloud_url=$(grep -oP 'CloudUrl[>=\"].*?https://[^\"<]+' /etc/Acronis/Global.config 2>/dev/null | grep -oP 'https://[^\"<]+' | head -1)
|
||||
if [ -n "$cloud_url" ]; then
|
||||
echo " ${cloud_url}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "2. Navigate to: Devices → Select this server"
|
||||
echo "3. Click 'Back up now' button"
|
||||
echo "4. Confirm backup settings"
|
||||
echo "5. Monitor progress in real-time"
|
||||
echo ""
|
||||
echo -e "${GREEN}Benefits:${NC}"
|
||||
echo " ✓ Visual progress monitoring"
|
||||
echo " ✓ Detailed status updates"
|
||||
echo " ✓ Easy cancellation if needed"
|
||||
echo " ✓ Automatic error notifications"
|
||||
;;
|
||||
|
||||
0|*)
|
||||
echo ""
|
||||
echo "Cancelled"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo ""
|
||||
press_enter
|
||||
Reference in New Issue
Block a user