Compare commits

...

23 Commits

Author SHA1 Message Date
cschantz 23599ca1a5 Improve Acronis backup trigger plan detection
- Add detection for when no CLI-managed plans exist
- Clarify that cloud-managed plans (web console) aren't visible via acrocmd
- Explain distinction between CLI-managed vs cloud-managed plans
- Provide guidance for both web console and CLI plan management
- Note that API credentials would be needed for cloud plan access

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 22:27:47 -05:00
cschantz 772a1d233d Simplify backup trigger menu - remove confusing options
Simplified flow:
1. Shows available plans from acrocmd
2. Prompts user to enter plan name/ID directly
3. Press Enter to cancel and see web console instructions
4. Then proceeds to backup type and performance selection

Removed:
- Confusing numbered options (1,2,3)
- "Run all plans" option (too dangerous)
- Redundant web console option

Now more intuitive - users just type the plan name they see.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 20:15:16 -05:00
cschantz a6bad70674 Add backup type selection and performance optimizations
Enhanced backup trigger script with:

Backup Type Selection:
- Auto (use plan's default)
- Full backup (--backuptype=full)
- Incremental (--backuptype=incremental) - faster, changes only
- Differential (--backuptype=differential) - changes since last full

Performance Optimizations:
- Lower compression (--compression=normal) - faster, larger size
- High priority (--priority=high) - use more resources
- Both combined

Users can now choose backup type and optimization level per backup,
allowing CLI operations to be faster than web console when needed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 20:11:13 -05:00
cschantz 093f1e6c23 Enhance cloud connectivity test with detailed feedback
Improved "Cloud Connectivity Test" section:
- Now shows as dedicated section with bold header
- Displays full URL being tested (https://us5-cloud.acronis.com)
- Shows HTTP status code on success (e.g., "✓ Reachable (HTTP 200)")
- Provides troubleshooting steps on failure:
  • Check internet connectivity
  • Verify firewall allows HTTPS (port 443)
  • Manual test command provided

This makes it easy to verify the agent can reach Acronis cloud
and diagnose connectivity issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:07:24 -05:00
cschantz c8f4335a71 Remove Quick Actions menu from agent status display
Removed interactive Quick Actions (start/stop/restart/logs/version)
from agent status screen. These were redundant with existing menu
options and cluttered the status display.

Status screen now shows info and returns to menu immediately.

Log analysis will be handled in the troubleshoot script instead,
which will comprehensively check all Acronis logs for issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:06:15 -05:00
cschantz 78d3bbaa3f Remove assumption of 50GB quota, defer to web console
Cannot reliably determine total cloud storage quota via CLI.
Removed hardcoded 50GB assumption since plans vary.

Now shows:
- Available: 30.96 GB (accurate from acrocmd)
- Used: (Check web console for accurate usage)

This is the safest approach since:
- Total quota not exposed via acrocmd or config files
- acrocmd list licenses fails for cloud-managed agents
- Web console always has accurate real-time usage data

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:02:32 -05:00
cschantz 04a76310ba Calculate actual cloud storage usage from available quota
When acrocmd shows "Occupied: 0 GB" (agent sync issue), calculate
actual usage by subtracting available from 50GB total quota.

Now displays:
  Used: ~19.04 GB (50GB - 30.96GB available)

This shows the real 19GB usage that appears in web console by
reverse-calculating from remaining quota (30.96 GB).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 17:01:05 -05:00
cschantz a0fb5e58e9 Add cloud backup storage display via acrocmd list vaults
Added "Cloud Backup Storage" section showing:
- Vault name
- Used storage (occupied)
- Available storage (free quota)

Uses 'acrocmd list vaults' to query actual cloud storage usage
that was previously only visible in web console.

This will show the 19GB backup storage usage the user was asking about.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 16:56:59 -05:00
cschantz 472978bf06 Deduplicate port 9850 in network connectivity display
Port 9850 was showing twice because it listens on both IPv4 (127.0.0.1)
and IPv6 (::1). Added awk deduplication to show each port only once.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 16:54:17 -05:00
cschantz 38cb4f7318 Clarify local vs cloud storage in agent status
Changed "Storage Status" to "Local Storage Status" to clearly indicate
this shows agent data (130M cache/logs/config), not backup storage.

Added note directing users to Acronis web console for actual backup
storage usage (19GB cloud storage shown there).

Prevents confusion between:
- Local agent data: 130M (what script shows)
- Cloud backup storage: 19GB (shown in web interface)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 16:52:11 -05:00
cschantz a978893c60 Improve Acronis agent registration and port detection
Fixed Issues:
- Registration check now uses correct config file (user.config)
- Parses actual registration XML to verify cloud connection
- Shows registration URL and environment

Port Monitoring:
- Now detects actual Acronis listening ports via netstat
- Shows real local ports (9850 for MMS, dynamic ports for aakore)
- Identifies which service owns each port
- Tests actual cloud connectivity with timeout

Changes:
- Registration verified from /var/lib/Acronis/.../user.config
- Port 9850 (localhost): MMS management service
- Dynamic ports: aakore agent core
- Added cloud connectivity test to registration URL

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 16:38:58 -05:00
cschantz 7ccbdcd4c0 Fix local variable usage in acronis-agent-status.sh
Fixed error where 'local' keyword was used outside of a function in
the storage status section. Changed to regular variable declarations
and added null check for use_percent to prevent integer expression errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 16:35:38 -05:00
cschantz bfbddf363a 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>
2025-11-06 16:25:10 -05:00
cschantz acad96bf93 Implement functional Acronis agent upgrade
Completely rewrote acronis-update.sh to actually perform upgrades:

Features:
- Checks current version before upgrade
- Shows service status
- Two upgrade methods:
  1. Automatic (web console instructions)
  2. Manual (downloads and runs upgrade)

Manual Upgrade Process:
- Detects existing installation automatically
- Extracts cloud URL from /etc/Acronis/Global.config
- Downloads latest installer from correct region
- Runs installer in unattended mode (-a flag)
- Installer automatically upgrades over existing installation
- Preserves configuration and registration
- Shows version before/after upgrade
- Verifies services running after upgrade
- Offers to restart services if needed
- Cleans up download files

What Gets Preserved During Upgrade:
✓ Agent registration (stays connected to account)
✓ Backup plan configurations
✓ Connection settings
✓ Service configurations

Based on Acronis documentation research:
- Running installer over existing installation = automatic upgrade
- No uninstall needed
- No re-registration needed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 16:12:24 -05:00
cschantz b62c83100c Use toolkit downloads folder instead of /tmp or /root
Better approach per user suggestion:
- Downloads to: /root/server-toolkit/downloads/acronis-install-YYYYMMDD-HHMMSS/
- Keeps toolkit directory organized
- Avoids polluting /root
- Avoids /tmp noexec issues
- Added downloads/ to .gitignore
- Cleanup removes timestamped installation directory after completion

Benefits:
- All downloads in one place
- Easy to find if debugging needed
- Cleaner than scattered in /root
- Still allows execution (not in /tmp)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 16:06:35 -05:00
cschantz 1d9e30bb54 Fix installer execution by using /root instead of /tmp
Root cause: /tmp is mounted with noexec flag preventing execution.

Changed TEMP_DIR from /tmp/acronis-install to /root/acronis-install
This allows the installer binary to execute properly.

Verified: mount shows /tmp with noexec option
Solution: Use /root which allows execution

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 16:03:06 -05:00
cschantz 8922dcbe05 Simplify installer execution - remove overly strict checks
Removed the -x check that was failing despite file being executable.
Changed to simple file existence and size validation instead.
Back to direct execution (./ ) instead of bash wrapper.

The file shows -rwxr-xr-x so it has execute permissions.
The issue was the test itself, not the permissions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 16:00:50 -05:00
cschantz 573181216a Fix Acronis installer execution permissions issue
Changes:
- Added verification after chmod +x to ensure permissions were set
- Changed execution from './file' to 'bash ./file' for better compatibility
- Added detailed error handling if chmod fails
- Shows file permissions on error for debugging

This fixes 'Permission denied' error (exit code 126) when running installer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 15:58:24 -05:00
cschantz 9b7f3a1920 Fix installer confirmation to accept 'y' in addition to 'yes'
Changed confirmation check from exact 'yes' match to regex pattern that accepts:
- y, Y
- yes, Yes, YES
- Any case variation

This prevents user frustration when typing 'y' instead of full 'yes'.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 15:46:13 -05:00
cschantz 4aaa4b3f2b Enhance Acronis installer with advanced/custom mode and better token handling
Added option 5 "Advanced/Custom installation" to installer with:

Interactive Option Builder:
- Unattended mode toggle (auto-accept prompts)
- Registration options:
  * Register with token during install
  * Skip registration (register later)
  * Interactive (let installer prompt)
- Verbose logging flag
- Custom flags input for any additional options
  (proxy, language, bandwidth throttling, etc.)

Improved Token Input:
- Better instructions for obtaining token from web console
- Automatic whitespace/linebreak removal for pasted tokens
- Works with copy-paste from web console
- Handles multi-line paste gracefully

Enhanced Service URL Selection:
- Shows common regions with examples:
  * us5-cloud.acronis.com (US)
  * eu2-cloud.acronis.com (Europe)
  * ap1-cloud.acronis.com (Asia Pacific)
  * ca1-cloud.acronis.com (Canada)
- Only prompts for URL when registration is enabled

Installation Modes Now Available:
1. Interactive installation - guided with prompts
2. Unattended installation - auto-accepts all
3. Install and register with token - one-step setup
4. Install without registration - defer registration
5. Advanced/Custom - build custom flag combination

Example Advanced Mode Usage:
- Select unattended: y
- Registration: option 1 (with token)
- Paste token: [automatically strips spaces]
- Verbose logging: y
- Custom flags: --proxy=http://proxy:8080

All flags are shown in summary before installation proceeds.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 21:39:57 -05:00
cschantz aa6a2ac2df Add comprehensive Acronis backup troubleshooting tool
Created acronis-troubleshoot.sh with intelligent diagnostic capabilities:

7-Point Diagnostic System:
1. Service Health Check
   - Verifies all 4 Acronis services (aakore, mms, schedule, active-protection)
   - Detects stopped/failed services
   - Auto-generates restart recommendations

2. Disk Space Analysis
   - Checks /var/lib/Acronis and root filesystem
   - Warns at 90%, critical at 95% usage
   - Identifies insufficient space for backups

3. Memory Monitoring
   - Tracks system memory usage
   - Warns at high memory conditions (>90%)
   - Detects potential memory leaks

4. Network Connectivity Testing
   - Tests connection to Acronis Cloud URL
   - DNS resolution verification
   - Identifies firewall/network issues

5. Multi-Location Log Scanning
   - Scans multiple log locations:
     * /var/lib/Acronis/BackupAndRecovery/MMS/mms.*.log
     * /var/log/acronis/agent/*.log
     * System logs (/var/log/messages, /var/log/syslog)
   - Pattern detection for 8 common failure types:
     * Insufficient space errors
     * Permission denied
     * Connection failures
     * Authentication failures
     * Backup task failures
     * VSS/snapshot errors
     * Database errors
     * File locking issues

6. Stuck Process Detection
   - Identifies long-running Acronis processes
   - Detects hung backup jobs
   - Recommends service restarts when needed

7. Configuration Verification
   - Checks backup plan configuration
   - Verifies agent version
   - Registration status validation

Intelligent Recommendations:
- Context-aware fix suggestions based on detected issues
- Prioritized action items (critical vs warnings)
- Specific commands to resolve each issue type

Quick Actions Menu:
1. View all errors from logs
2. Restart all services
3. Generate detailed diagnostic report for support
4. Export logs as tar.gz archive

Issue Tracking:
- Categorizes findings as CRITICAL or WARNINGS
- Provides comprehensive summary with counts
- Color-coded output (red=critical, yellow=warning, green=ok)

Added to Acronis menu as option 12 (Troubleshooting section)

This tool enables rapid diagnosis of backup failures without needing
to manually dig through logs or check multiple system components.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 21:36:13 -05:00
cschantz 8fbfc73991 Implement Acronis Cyber Protect agent management scripts
Created 11 comprehensive scripts for Acronis backup management:

Installation & Setup:
- acronis-install.sh: Download/install agent with multiple modes
  * Interactive, unattended, with/without registration
  * Supports token-based registration during install
  * Auto-service startup and verification
- acronis-register.sh: Register agent with Acronis Cloud
  * Validates service URL and token
  * Shows current registration status
  * Safe re-registration with confirmation
- acronis-configure.sh: Guidance for backup plan configuration
  * Web console walkthrough
  * Common backup plan examples

Backup Operations:
- acronis-manual-backup.sh: Manual backup creation guide
  * Web console and CLI methods
  * Ready for full CLI implementation
- acronis-status.sh: View backup status from logs
  * Recent backup activity
  * acrocmd integration ready
- acronis-list-backups.sh: List available backup archives
  * acrocmd integration for archive listing
- acronis-restore.sh: Restore from backup guide
  * Multiple restore methods explained
  * Safety warnings and best practices

Management:
- acronis-agent-status.sh: Comprehensive service status
  * All 4 services (aakore, mms, schedule, active-protection)
  * Registration status, network ports, storage
  * Quick actions: start/stop/restart/logs/version
- acronis-update.sh: Agent update management
  * Auto and manual update methods
  * Version checking
- acronis-logs.sh: Advanced log viewer
  * View, tail, search logs
  * Error filtering with color coding
  * Log archival for old logs
- acronis-uninstall.sh: Safe agent removal
  * Stops services, unregisters, removes packages
  * Optional data retention
  * Comprehensive cleanup

All scripts based on documented Acronis commands with proper error
handling, status validation, and user-friendly interfaces.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 21:30:19 -05:00
cschantz ecb5f249ed Add Acronis Cyber Protect submenu to Backup & Recovery
Reorganized Backup & Recovery menu to include dedicated Acronis submenu:
- Added Acronis Management submenu (option 9) with 11 operations:
  * Installation & Setup: Install, register, configure
  * Backup Operations: Manual backup, status, list, restore
  * Management: Agent status, update, logs, uninstall
- Moved cleanup-toolkit-data.sh from option 9 to option 10
- Created handle_acronis_menu() function to route to Acronis scripts
- All Acronis operations grouped under backup/acronis-*.sh modules

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 21:14:11 -05:00
19 changed files with 3269 additions and 2 deletions
+1
View File
@@ -54,3 +54,4 @@ id_ed25519.pub
# Config files that might contain sensitive data
config.local.*
*.credentials
downloads/
+61 -2
View File
@@ -550,6 +550,8 @@ show_backup_menu() {
show_banner
echo -e "${YELLOW}${BOLD}💾 Backup & Recovery${NC}"
echo ""
echo -e "${BOLD}cPanel Backups:${NC}"
echo ""
echo -e " ${YELLOW}1)${NC} Auto Backup (All Sites) - Create full backups"
echo -e " ${YELLOW}2)${NC} Selective Backup - Backup specific accounts"
echo -e " ${YELLOW}3)${NC} Restore Helper - Interactive restore tool"
@@ -559,9 +561,13 @@ show_backup_menu() {
echo -e " ${YELLOW}7)${NC} Backup Verification - Test backup integrity"
echo -e " ${YELLOW}8)${NC} Off-site Sync - Sync to remote storage"
echo ""
echo -e "${BOLD}Acronis Cyber Protect:${NC}"
echo ""
echo -e " ${YELLOW}9)${NC} 🔷 Acronis Management → Install, configure, manage backups"
echo ""
echo -e "${BOLD}Data Management:${NC}"
echo ""
echo -e " ${RED}9)${NC} 🗑️ Cleanup Toolkit Data - Remove IP reputation & temp files"
echo -e " ${RED}10)${NC} 🗑️ Cleanup Toolkit Data - Remove IP reputation & temp files"
echo ""
echo -e " ${RED}0)${NC} Back to Main Menu"
echo ""
@@ -569,6 +575,58 @@ show_backup_menu() {
echo -n "Select option: "
}
# Acronis Management submenu
show_acronis_menu() {
show_banner
echo -e "${YELLOW}${BOLD}🔷 Acronis Cyber Protect${NC}"
echo ""
echo -e "${BOLD}Installation & Setup:${NC}"
echo ""
echo -e " ${YELLOW}1)${NC} Install Acronis Agent - Download and install Acronis"
echo -e " ${YELLOW}2)${NC} Register with Cloud - Connect to Acronis Cloud"
echo ""
echo -e "${BOLD}Backup Management:${NC}"
echo ""
echo -e " ${GREEN}3)${NC} 📊 Manage Backups - Complete backup management interface"
echo ""
echo -e "${BOLD}Quick Actions:${NC}"
echo ""
echo -e " ${YELLOW}4)${NC} Check Agent Status - Verify Acronis is running"
echo -e " ${YELLOW}5)${NC} Update Agent - Upgrade to latest version"
echo -e " ${YELLOW}6)${NC} View Logs - Check Acronis logs"
echo -e " ${YELLOW}7)${NC} Uninstall Acronis - Remove Acronis agent"
echo ""
echo -e "${BOLD}Troubleshooting:${NC}"
echo ""
echo -e " ${RED}8)${NC} 🔧 Troubleshoot Backups - Diagnose backup failures"
echo ""
echo -e " ${RED}0)${NC} Back to Backup & Recovery"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo -n "Select option: "
}
# Acronis submenu handler
handle_acronis_menu() {
while true; do
show_acronis_menu
read -r choice
case $choice in
1) run_module "backup" "acronis-install.sh" ;;
2) run_module "backup" "acronis-register.sh" ;;
3) run_module "backup" "acronis-backup-manager.sh" ;;
4) run_module "backup" "acronis-agent-status.sh" ;;
5) run_module "backup" "acronis-update.sh" ;;
6) run_module "backup" "acronis-logs.sh" ;;
7) run_module "backup" "acronis-uninstall.sh" ;;
8) run_module "backup" "acronis-troubleshoot.sh" ;;
0) return ;;
*) echo -e "${RED}Invalid option${NC}"; sleep 1 ;;
esac
done
}
# Monitoring menu
show_monitoring_menu() {
show_banner
@@ -1324,7 +1382,8 @@ handle_backup_menu() {
6) run_module "backup" "log-archive.sh" ;;
7) run_module "backup" "backup-verification.sh" ;;
8) run_module "backup" "offsite-sync.sh" ;;
9) run_module "maintenance" "cleanup-toolkit-data.sh" ;;
9) handle_acronis_menu ;;
10) run_module "maintenance" "cleanup-toolkit-data.sh" ;;
0) return ;;
*) echo -e "${RED}Invalid option${NC}"; sleep 1 ;;
esac
+268
View File
@@ -0,0 +1,268 @@
#!/bin/bash
################################################################################
# Acronis Agent Status Checker
################################################################################
# Purpose: Check status of all Acronis Cyber Protect services
# Services monitored:
# - aakore (Acronis Agent Core)
# - acronis_mms (Management Service)
# - acronis_schedule (Scheduler)
# - active-protection.service (Ransomware Protection)
################################################################################
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$SCRIPT_DIR/lib/common-functions.sh"
source "$SCRIPT_DIR/lib/system-detect.sh"
# Require root
if [ "$EUID" -ne 0 ]; then
print_error "This script must be run as root"
exit 1
fi
print_banner "Acronis Agent Status"
echo ""
echo -e "${BOLD}Checking Acronis Cyber Protect Services...${NC}"
echo ""
# Array of services to check
declare -a SERVICES=(
"aakore:Acronis Agent Core"
"acronis_mms:Management Service"
"acronis_schedule:Backup Scheduler"
"active-protection:Ransomware Protection"
)
# Track overall status
all_running=true
any_installed=false
# Function to check service status
check_service_status() {
local service_name="$1"
local service_desc="$2"
# Check if service exists
if systemctl list-unit-files | grep -q "^${service_name}.service"; then
any_installed=true
# Get service status
if systemctl is-active --quiet "$service_name"; then
echo -e " ${GREEN}${NC} ${BOLD}${service_desc}${NC}"
echo -e " Status: ${GREEN}RUNNING${NC}"
# Get uptime
local uptime=$(systemctl show "$service_name" -p ActiveEnterTimestamp --value)
if [ -n "$uptime" ]; then
echo -e " Uptime: ${uptime}"
fi
# Get PID
local pid=$(systemctl show "$service_name" -p MainPID --value)
if [ "$pid" != "0" ]; then
echo -e " PID: ${pid}"
fi
else
all_running=false
echo -e " ${RED}${NC} ${BOLD}${service_desc}${NC}"
echo -e " Status: ${RED}STOPPED${NC}"
# Check if failed
if systemctl is-failed --quiet "$service_name"; then
echo -e " ${RED}[FAILED]${NC} - Service has errors"
fi
fi
echo ""
elif service "$service_name" status &>/dev/null; then
# Fallback to service command for older systems
any_installed=true
if service "$service_name" status | grep -q "running"; then
echo -e " ${GREEN}${NC} ${BOLD}${service_desc}${NC}"
echo -e " Status: ${GREEN}RUNNING${NC}"
else
all_running=false
echo -e " ${RED}${NC} ${BOLD}${service_desc}${NC}"
echo -e " Status: ${RED}STOPPED${NC}"
fi
echo ""
fi
}
# Check each service
for service_entry in "${SERVICES[@]}"; do
IFS=':' read -r service_name service_desc <<< "$service_entry"
check_service_status "$service_name" "$service_desc"
done
# Check if Acronis is even installed
if [ "$any_installed" = false ]; then
echo -e "${YELLOW}${BOLD}⚠ Acronis Agent Not Installed${NC}"
echo ""
echo "Acronis Cyber Protect is not installed on this system."
echo ""
echo "To install:"
echo " 1. Return to Backup & Recovery menu"
echo " 2. Select 'Acronis Management'"
echo " 3. Choose 'Install Acronis Agent'"
echo ""
press_enter
exit 0
fi
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
# Overall status summary
if [ "$all_running" = true ]; then
echo -e "${GREEN}${BOLD}✓ All Services Running${NC}"
echo ""
echo "Acronis Cyber Protect is operational and ready for backups."
else
echo -e "${YELLOW}${BOLD}⚠ Some Services Not Running${NC}"
echo ""
echo "Some Acronis services are stopped. You may want to:"
echo " • Start services: Select 'Service Management' from Acronis menu"
echo " • Check logs: Select 'View Logs' for error details"
echo " • Restart services: Try restarting all services"
fi
echo ""
# Check agent registration status
echo -e "${BOLD}Agent Registration:${NC}"
if [ -f "/var/lib/Acronis/BackupAndRecovery/MMS/user.config" ]; then
# Check for registration info in user.config
if grep -q "<registration>" "/var/lib/Acronis/BackupAndRecovery/MMS/user.config" 2>/dev/null; then
reg_address=$(grep -oP '<address>\K[^<]+' /var/lib/Acronis/BackupAndRecovery/MMS/user.config 2>/dev/null)
reg_env=$(grep -oP '<environment>\K[^<]+' /var/lib/Acronis/BackupAndRecovery/MMS/user.config 2>/dev/null)
if [ -n "$reg_address" ]; then
echo -e " ${GREEN}${NC} Agent is registered with Acronis Cloud"
echo -e " URL: ${reg_address}"
[ -n "$reg_env" ] && echo -e " Environment: ${reg_env}"
else
echo -e " ${YELLOW}${NC} Registration incomplete"
fi
else
echo -e " ${YELLOW}${NC} Agent not registered"
fi
else
echo -e " ${YELLOW}${NC} Configuration file not found"
fi
echo ""
# Check active ports
echo -e "${BOLD}Network Connectivity:${NC}"
# Check for actual Acronis listening ports (deduplicate IPv4/IPv6)
acronis_ports=$(netstat -tlnp 2>/dev/null | grep -E "(acronis|mms|aakore)" | awk '{
split($4, addr, ":");
port = addr[length(addr)];
if (!seen[port]++) {
print $4 " " $7;
}
}')
if [ -n "$acronis_ports" ]; then
echo "Active Acronis services:"
echo "$acronis_ports" | while read -r addr process; do
port=$(echo "$addr" | grep -oP ':\K[0-9]+$')
if echo "$addr" | grep -q "127.0.0.1\|::1"; then
# Local-only port
if [ "$port" = "9850" ]; then
echo -e " ${GREEN}${NC} Port $port (localhost) - MMS Service"
else
echo -e " ${GREEN}${NC} Port $port (localhost) - $(basename "$process" | cut -d/ -f2)"
fi
else
echo -e " ${GREEN}${NC} Port $port - $(basename "$process" | cut -d/ -f2)"
fi
done
else
echo -e " ${YELLOW}${NC} No Acronis ports detected"
fi
echo ""
# Check outbound connectivity to cloud (port 443)
echo ""
echo -e "${BOLD}Cloud Connectivity Test:${NC}"
if command -v curl >/dev/null 2>&1; then
reg_url=$(grep -oP '<address>\K[^<]+' /var/lib/Acronis/BackupAndRecovery/MMS/user.config 2>/dev/null)
if [ -n "$reg_url" ]; then
echo -n " Testing ${reg_url}... "
http_code=$(timeout 5 curl -s -o /dev/null -w "%{http_code}" "$reg_url" 2>/dev/null)
if [ "$http_code" -ge 200 ] && [ "$http_code" -lt 500 ]; then
echo -e "${GREEN}✓ Reachable${NC} (HTTP $http_code)"
else
echo -e "${RED}✗ Unreachable${NC}"
echo -e " ${YELLOW}${NC} Cannot reach Acronis cloud (firewall/network issue)"
echo " • Check internet connectivity"
echo " • Verify firewall allows HTTPS (port 443)"
echo " • Test manually: curl -I $reg_url"
fi
else
echo -e " ${YELLOW}${NC} Cloud URL not found in config"
fi
else
echo -e " ${YELLOW}${NC} curl not installed (cannot test connectivity)"
fi
echo ""
# Check cloud storage quota
echo -e "${BOLD}Cloud Backup Storage:${NC}"
if command -v acrocmd >/dev/null 2>&1; then
vault_info=$(acrocmd list vaults 2>/dev/null | tail -n +3 | head -1)
if [ -n "$vault_info" ]; then
# Extract storage info from vault output
vault_name=$(echo "$vault_info" | awk '{print $1}')
vault_free_val=$(echo "$vault_info" | awk '{print $4}')
vault_free_unit=$(echo "$vault_info" | awk '{print $5}')
vault_occupied=$(echo "$vault_info" | awk '{print $6, $7}')
echo -e " Vault: ${vault_name}"
echo -e " Available: ${vault_free_val} ${vault_free_unit}"
# Show occupied if available, otherwise note it's not synced
if [ "$vault_occupied" != "0 GB" ]; then
echo -e " Used: ${vault_occupied}"
else
echo -e " Used: ${DIM}(Check web console for accurate usage)${NC}"
fi
else
echo -e " ${YELLOW}${NC} No vault information available"
echo -e " ${DIM}(Cloud storage visible after first backup)${NC}"
fi
else
echo -e " ${YELLOW}${NC} acrocmd not available"
fi
echo ""
# Check local disk space
echo -e "${BOLD}Local Storage Status:${NC}"
if [ -d "/var/lib/Acronis" ]; then
backup_dir_size=$(du -sh /var/lib/Acronis 2>/dev/null | awk '{print $1}')
echo -e " Agent data: ${backup_dir_size} (local cache/logs/config)"
# Check free space on partition
free_space=$(df -h /var/lib/Acronis | tail -1 | awk '{print $4}')
use_percent=$(df -h /var/lib/Acronis | tail -1 | awk '{print $5}' | tr -d '%')
echo -e " Free space: ${free_space} (on root partition)"
if [ -n "$use_percent" ] && [ "$use_percent" -gt 90 ] 2>/dev/null; then
echo -e " ${RED}⚠ Warning: Disk usage at ${use_percent}%${NC}"
fi
fi
echo ""
press_enter
+103
View File
@@ -0,0 +1,103 @@
#!/bin/bash
################################################################################
# Acronis Backup Manager
################################################################################
# Purpose: Main interface for Acronis backup operations
# Features:
# - List backups and archives
# - Trigger manual backups
# - View backup schedules
# - Monitor backup/recovery status
################################################################################
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
# Check if Acronis is installed
if ! systemctl list-unit-files | grep -q "acronis_mms.service"; then
print_error "Acronis is not installed"
echo ""
echo "Install Acronis first from the Acronis menu."
echo ""
press_enter
exit 1
fi
# Check if acrocmd is available
if [ ! -f "/usr/sbin/acrocmd" ]; then
print_error "acrocmd command-line tool not found"
echo ""
echo "This may indicate an incomplete Acronis installation."
echo ""
press_enter
exit 1
fi
while true; do
clear
print_banner "Backup Management"
echo ""
echo -e "${BOLD}Agent Management${NC}"
echo -e " ${YELLOW}1)${NC} Check Agent Status"
echo -e " ${YELLOW}2)${NC} View Agent Logs"
echo ""
echo -e "${BOLD}Backup Operations${NC}"
echo -e " ${YELLOW}3)${NC} List Backups & Archives"
echo -e " ${YELLOW}4)${NC} Trigger Manual Backup"
echo -e " ${YELLOW}5)${NC} Check Backup Status"
echo ""
echo -e "${BOLD}Plan Management${NC}"
echo -e " ${YELLOW}6)${NC} View Backup Plans/Schedules"
echo -e " ${YELLOW}7)${NC} Manage Protection Plans"
echo ""
echo -e "${BOLD}Restore Operations${NC}"
echo -e " ${YELLOW}8)${NC} Restore from Backup (Future)"
echo ""
echo -e " ${YELLOW}0)${NC} Return to Acronis Menu"
echo ""
echo -n "Select option: "
read -r choice
case "$choice" in
1)
bash "$SCRIPT_DIR/modules/backup/acronis-agent-status.sh"
;;
2)
bash "$SCRIPT_DIR/modules/backup/acronis-logs.sh"
;;
3)
bash "$SCRIPT_DIR/modules/backup/acronis-list-backups.sh"
;;
4)
bash "$SCRIPT_DIR/modules/backup/acronis-trigger-backup.sh"
;;
5)
bash "$SCRIPT_DIR/modules/backup/acronis-backup-status.sh"
;;
6)
bash "$SCRIPT_DIR/modules/backup/acronis-schedule-viewer.sh"
;;
7)
bash "$SCRIPT_DIR/modules/backup/acronis-plan-manager.sh"
;;
8)
bash "$SCRIPT_DIR/modules/backup/acronis-restore.sh"
;;
0)
exit 0
;;
*)
echo ""
print_error "Invalid option"
sleep 1
;;
esac
done
+118
View File
@@ -0,0 +1,118 @@
#!/bin/bash
################################################################################
# Acronis Backup Status
################################################################################
# Purpose: Check status of backup operations using acrocmd
# Features:
# - Show active/running backups
# - Display recent backup history
# - Show backup task status
################################################################################
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 "Backup Status"
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
# Show active/running tasks
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo -e "${BOLD}Active Backup Tasks${NC}"
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo ""
task_output=$(/usr/sbin/acrocmd list tasks 2>&1)
if echo "$task_output" | grep -qi "no.*tasks\|error"; then
echo -e "${GREEN}${NC} No active backup tasks running"
else
echo "$task_output"
fi
echo ""
# Show recent activities
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo -e "${BOLD}Recent Backup Activities${NC}"
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo ""
activity_output=$(/usr/sbin/acrocmd list activities 2>&1)
if echo "$activity_output" | grep -qi "no.*activities\|error"; then
echo -e "${YELLOW}No recent backup activities found${NC}"
echo ""
echo "This may indicate:"
echo " • No backups have been run yet"
echo " • Agent needs registration"
echo " • No backup plans configured"
else
echo "$activity_output" | tail -20
fi
echo ""
# Parse logs for backup status
if [ -f "/var/lib/Acronis/BackupAndRecovery/MMS/mms.0.log" ]; then
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo -e "${BOLD}Log Summary${NC}"
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo ""
# Count recent backup events
log_file="/var/lib/Acronis/BackupAndRecovery/MMS/mms.0.log"
completed=$(grep -ic "backup.*completed\|backup.*success" "$log_file" 2>/dev/null || echo "0")
failed=$(grep -ic "backup.*failed\|backup.*error" "$log_file" 2>/dev/null || echo "0")
started=$(grep -ic "backup.*started\|backup.*begin" "$log_file" 2>/dev/null || echo "0")
echo "Backup Statistics (from current log):"
echo " • Started: $started"
echo " • Completed: $completed"
echo " • Failed: $failed"
echo ""
# Show last 5 backup-related events
echo "Recent Events:"
echo ""
grep -i "backup" "$log_file" 2>/dev/null | tail -5 | while read -r line; do
# Highlight status
if echo "$line" | grep -qi "success\|completed"; then
echo -e " ${GREEN}${NC} $line"
elif echo "$line" | grep -qi "fail\|error"; then
echo -e " ${RED}${NC} $line"
else
echo "$line"
fi
done
fi
echo ""
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo ""
echo -e "${BOLD}Options:${NC}"
echo ""
echo " • View full logs: Select 'View Agent Logs' from menu"
echo " • Trigger backup: Select 'Trigger Manual Backup'"
echo " • Troubleshoot: Use 'Troubleshoot Backups' for diagnostics"
echo ""
press_enter
+54
View File
@@ -0,0 +1,54 @@
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$SCRIPT_DIR/lib/common-functions.sh"
if [ "$EUID" -ne 0 ]; then
print_error "This script must be run as root"
exit 1
fi
print_banner "Configure Backup Plans"
echo ""
echo -e "${BOLD}Acronis Backup Plan Configuration${NC}"
echo ""
echo "Backup plans are configured through the Acronis web console."
echo ""
echo -e "${CYAN}Steps to configure backup plans:${NC}"
echo ""
echo "1. Log in to your Acronis web console"
echo " → https://us5-cloud.acronis.com (or your region)"
echo ""
echo "2. Navigate to: Devices → All devices"
echo ""
echo "3. Find this server in the device list"
echo ""
echo "4. Click on the device and select 'Protection'"
echo ""
echo "5. Click 'Add plan' and configure:"
echo " • Backup source (files, folders, system)"
echo " • Backup schedule (hourly, daily, weekly)"
echo " • Retention policy (how long to keep backups)"
echo " • Backup location (cloud or local)"
echo ""
echo "6. Apply the plan to this device"
echo ""
echo -e "${BOLD}Common Backup Plans:${NC}"
echo ""
echo " • Full Server Backup"
echo " → Entire system image for disaster recovery"
echo ""
echo " • cPanel Accounts"
echo " → /home/* directories for user data"
echo ""
echo " • Databases"
echo " → MySQL/MariaDB databases with consistent snapshots"
echo ""
echo " • Configuration Files"
echo " → /etc and other critical configs"
echo ""
echo " • Web Files"
echo " → /home/*/public_html websites"
echo ""
press_enter
+361
View File
@@ -0,0 +1,361 @@
#!/bin/bash
################################################################################
# Acronis Agent Installer
################################################################################
# Purpose: Download and install Acronis Cyber Protect agent
# Supports:
# - Interactive installation with prompts
# - Unattended installation (-a flag)
# - Skip registration (--skip-registration)
# - Install with token (--token=xxx)
# - Custom service URL (--rain=xxx)
################################################################################
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$SCRIPT_DIR/lib/common-functions.sh"
source "$SCRIPT_DIR/lib/system-detect.sh"
# Require root
if [ "$EUID" -ne 0 ]; then
print_error "This script must be run as root"
exit 1
fi
print_banner "Acronis Agent Installation"
# Check if already installed
if systemctl list-unit-files | grep -q "acronis_mms.service"; then
echo ""
echo -e "${YELLOW}${BOLD}⚠ Acronis Already Installed${NC}"
echo ""
echo "Acronis Cyber Protect agent is already installed on this system."
echo ""
echo -n "Do you want to reinstall/upgrade? (yes/no): "
read -r reinstall
if [ "$reinstall" != "yes" ]; then
echo "Installation cancelled"
press_enter
exit 0
fi
fi
echo ""
echo -e "${BOLD}Acronis Cyber Protect Agent Installation${NC}"
echo ""
echo "This will download and install the latest Acronis agent for Linux (x86_64)."
echo ""
echo -e "${CYAN}Installation Options:${NC}"
echo ""
echo " 1) Interactive installation (default)"
echo " 2) Unattended installation (auto-accept)"
echo " 3) Install and register with token"
echo " 4) Install without registration"
echo " 5) Advanced/Custom installation (specify all flags)"
echo ""
echo -n "Select installation mode [1]: "
read -r install_mode
install_mode="${install_mode:-1}"
# Build installation flags
INSTALL_FLAGS=""
SERVICE_URL="us5-cloud.acronis.com"
REGISTRATION_TOKEN=""
case "$install_mode" in
2)
INSTALL_FLAGS="-a"
echo ""
echo "Mode: Unattended installation"
;;
3)
INSTALL_FLAGS="-a"
echo ""
echo -e "${BOLD}Register During Installation${NC}"
echo ""
echo "Paste your Acronis registration token below."
echo "To get a token:"
echo " 1. Log in to Acronis web console"
echo " 2. Go to: Settings → Registration tokens"
echo " 3. Create token or copy existing one"
echo ""
echo -n "Registration token: "
read -r REGISTRATION_TOKEN
# Allow pasting multi-line or trimming whitespace
REGISTRATION_TOKEN=$(echo "$REGISTRATION_TOKEN" | tr -d '[:space:]')
if [ -z "$REGISTRATION_TOKEN" ]; then
print_error "Token is required for this mode"
press_enter
exit 1
fi
INSTALL_FLAGS="$INSTALL_FLAGS --token=$REGISTRATION_TOKEN"
echo ""
echo "Mode: Install with registration token"
;;
4)
INSTALL_FLAGS="-a --skip-registration"
echo ""
echo "Mode: Install without registration"
;;
5)
# Advanced/Custom mode
echo ""
echo -e "${BOLD}Advanced Installation${NC}"
echo ""
echo "Build custom installation flags by selecting options."
echo ""
# Unattended mode
echo -n "Unattended install (auto-accept)? (y/n) [y]: "
read -r use_unattended
use_unattended="${use_unattended:-y}"
if [ "$use_unattended" = "y" ]; then
INSTALL_FLAGS="$INSTALL_FLAGS -a"
fi
# Registration options
echo ""
echo "Registration:"
echo " 1) Register with token during install"
echo " 2) Skip registration (register later)"
echo " 3) Interactive (installer will prompt)"
echo -n "Select [3]: "
read -r reg_choice
reg_choice="${reg_choice:-3}"
if [ "$reg_choice" = "1" ]; then
echo ""
echo "Paste your Acronis registration token:"
echo "(Spaces and line breaks will be automatically removed)"
echo ""
read -r REGISTRATION_TOKEN
REGISTRATION_TOKEN=$(echo "$REGISTRATION_TOKEN" | tr -d '[:space:]')
if [ -n "$REGISTRATION_TOKEN" ]; then
INSTALL_FLAGS="$INSTALL_FLAGS --token=$REGISTRATION_TOKEN"
else
print_error "Token cannot be empty"
press_enter
exit 1
fi
elif [ "$reg_choice" = "2" ]; then
INSTALL_FLAGS="$INSTALL_FLAGS --skip-registration"
fi
# Additional flags
echo ""
echo -e "${BOLD}Additional Options:${NC}"
echo ""
# Verbose logging
echo -n "Enable verbose logging? (y/n) [n]: "
read -r use_verbose
if [ "$use_verbose" = "y" ]; then
INSTALL_FLAGS="$INSTALL_FLAGS --verbose"
fi
# Custom flags
echo ""
echo "Enter any additional custom flags (or press Enter to skip):"
echo "Examples: --proxy=http://proxy:8080, --language=en, etc."
echo ""
echo -n "Custom flags: "
read -r custom_flags
if [ -n "$custom_flags" ]; then
INSTALL_FLAGS="$INSTALL_FLAGS $custom_flags"
fi
echo ""
echo "Mode: Advanced/Custom installation"
;;
*)
echo ""
echo "Mode: Interactive installation"
;;
esac
# Ask for service URL (for all modes except skip-registration)
if [[ "$INSTALL_FLAGS" != *"--skip-registration"* ]]; then
echo ""
echo -e "${BOLD}Acronis Cloud Region${NC}"
echo ""
echo "Common regions:"
echo " • us5-cloud.acronis.com (US - Default)"
echo " • eu2-cloud.acronis.com (Europe)"
echo " • ap1-cloud.acronis.com (Asia Pacific)"
echo " • ca1-cloud.acronis.com (Canada)"
echo ""
echo -n "Enter service URL [us5-cloud.acronis.com]: "
read -r input_url
if [ -n "$input_url" ]; then
SERVICE_URL="$input_url"
fi
# Add --rain flag if token is being used
if [[ "$INSTALL_FLAGS" == *"--token"* ]]; then
INSTALL_FLAGS="$INSTALL_FLAGS --rain=$SERVICE_URL"
fi
fi
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
echo -e "${BOLD}Installation Summary:${NC}"
echo ""
echo " Download URL: https://${SERVICE_URL}/bc/api/ams/links/agents/redirect"
echo " Architecture: x86_64 (64-bit)"
echo " Install flags: ${INSTALL_FLAGS:-none}"
echo " Service URL: ${SERVICE_URL}"
[ -n "$REGISTRATION_TOKEN" ] && echo " Token: ********"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
echo -n "Proceed with installation? (yes/no): "
read -r confirm
if [[ ! "$confirm" =~ ^[Yy]([Ee][Ss])?$ ]]; then
echo ""
print_error "Installation cancelled"
press_enter
exit 0
fi
echo ""
echo -e "${BOLD}Starting Installation...${NC}"
echo ""
# Create download directory in toolkit folder
DOWNLOAD_DIR="$SCRIPT_DIR/downloads"
mkdir -p "$DOWNLOAD_DIR"
cd "$DOWNLOAD_DIR" || exit 1
# Use timestamped subdirectory for this installation
INSTALL_DIR="$DOWNLOAD_DIR/acronis-install-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$INSTALL_DIR"
cd "$INSTALL_DIR" || exit 1
# Download installer
echo "→ Downloading Acronis agent installer..."
DOWNLOAD_URL="https://${SERVICE_URL}/bc/api/ams/links/agents/redirect?language=multi&system=linux&architecture=64&productType=enterprise"
if wget -q --show-progress "$DOWNLOAD_URL" -O "Cyber_Protection_Agent_for_Linux_x86_64.bin"; then
print_success "Download complete"
else
print_error "Download failed"
echo ""
echo "Possible causes:"
echo " • No internet connection"
echo " • Invalid service URL: ${SERVICE_URL}"
echo " • Firewall blocking connection"
echo ""
press_enter
cd /
rm -rf "$TEMP_DIR"
exit 1
fi
echo ""
# Make executable
chmod +x "Cyber_Protection_Agent_for_Linux_x86_64.bin" 2>/dev/null
# Verify file exists and has size
if [ ! -f "Cyber_Protection_Agent_for_Linux_x86_64.bin" ]; then
print_error "Installer file not found"
cd /
rm -rf "$TEMP_DIR"
press_enter
exit 1
fi
file_size=$(stat -c%s "Cyber_Protection_Agent_for_Linux_x86_64.bin" 2>/dev/null || echo "0")
if [ "$file_size" -lt 1000000 ]; then
print_error "Installer file is too small (possibly corrupted)"
cd /
rm -rf "$TEMP_DIR"
press_enter
exit 1
fi
# Run installer
echo "→ Running Acronis installer..."
echo ""
echo -e "${DIM}──────────────────────────────────────────────────────────────${NC}"
if [ -z "$INSTALL_FLAGS" ]; then
# Interactive mode - run directly
./Cyber_Protection_Agent_for_Linux_x86_64.bin
else
# Unattended mode - need to pass flags properly
./Cyber_Protection_Agent_for_Linux_x86_64.bin $INSTALL_FLAGS
fi
INSTALL_EXIT_CODE=$?
echo -e "${DIM}──────────────────────────────────────────────────────────────${NC}"
echo ""
# Check installation result
if [ $INSTALL_EXIT_CODE -eq 0 ]; then
print_success "Installation completed successfully!"
echo ""
# Start services
echo "→ Starting Acronis services..."
systemctl start aakore
systemctl start acronis_mms
systemctl start acronis_schedule
echo ""
# Check if services started
sleep 2
if systemctl is-active --quiet acronis_mms; then
print_success "Services started successfully"
echo ""
# Show next steps
echo -e "${BOLD}Next Steps:${NC}"
echo ""
if [ "$install_mode" = "4" ]; then
echo " 1. Register the agent with Acronis Cloud"
echo " → Select 'Register with Cloud' from Acronis menu"
echo ""
fi
echo " 2. Configure backup plans in Acronis web console"
echo " → Visit: https://${SERVICE_URL}"
echo ""
echo " 3. Check agent status"
echo " → Select 'Check Agent Status' from Acronis menu"
echo ""
else
print_error "Services failed to start"
echo ""
echo "Check logs for details:"
echo " tail -f /var/lib/Acronis/BackupAndRecovery/MMS/mms.0.log"
echo ""
fi
else
print_error "Installation failed with exit code $INSTALL_EXIT_CODE"
echo ""
echo "Check the output above for error details."
echo ""
echo "Common issues:"
echo " • Incompatible system (requires 64-bit Linux)"
echo " • Insufficient disk space"
echo " • Conflicting backup software"
echo " • Invalid registration token"
echo ""
fi
# Cleanup
echo "→ Cleaning up installation files..."
cd "$SCRIPT_DIR"
rm -rf "$INSTALL_DIR"
echo ""
press_enter
+76
View File
@@ -0,0 +1,76 @@
#!/bin/bash
################################################################################
# Acronis List Backups
################################################################################
# Purpose: List all backups and archives using acrocmd
# Features:
# - Show backup archives
# - Show backup versions
# - Display backup details (size, date, location)
################################################################################
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 "List Backups & Archives"
echo ""
echo -e "${BOLD}Retrieving backup information...${NC}"
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 archives
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo -e "${BOLD}Backup Archives${NC}"
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo ""
if /usr/sbin/acrocmd list archives 2>/dev/null | grep -q .; then
/usr/sbin/acrocmd list archives 2>/dev/null
else
echo -e "${YELLOW}No backup archives found${NC}"
echo ""
echo "Possible reasons:"
echo " • No backups have been created yet"
echo " • Agent not registered with Acronis Cloud"
echo " • No backup plans configured"
fi
echo ""
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo -e "${BOLD}Backup Details${NC}"
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo ""
if /usr/sbin/acrocmd list backups 2>/dev/null | grep -q .; then
/usr/sbin/acrocmd list backups 2>/dev/null
else
echo -e "${YELLOW}No backup details available${NC}"
fi
echo ""
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo ""
echo -e "${BOLD}Options:${NC}"
echo ""
echo " • Create backups via 'Trigger Manual Backup'"
echo " • Configure plans in Acronis web console"
echo " • Check backup status for active operations"
echo ""
press_enter
+296
View File
@@ -0,0 +1,296 @@
#!/bin/bash
################################################################################
# Acronis Log Viewer
################################################################################
# Purpose: View and tail Acronis Cyber Protect logs
# Log location: /var/lib/Acronis/BackupAndRecovery/MMS/
# Primary log: mms.0.log
################################################################################
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$SCRIPT_DIR/lib/common-functions.sh"
source "$SCRIPT_DIR/lib/system-detect.sh"
# Require root
if [ "$EUID" -ne 0 ]; then
print_error "This script must be run as root"
exit 1
fi
# Log directory
LOG_DIR="/var/lib/Acronis/BackupAndRecovery/MMS"
PRIMARY_LOG="$LOG_DIR/mms.0.log"
print_banner "Acronis Logs Viewer"
# Check if Acronis is installed
if [ ! -d "$LOG_DIR" ]; then
echo ""
print_error "Acronis log directory not found"
echo ""
echo "Acronis may not be installed or logs are in a different location."
echo ""
press_enter
exit 1
fi
echo ""
echo -e "${BOLD}Acronis Log Management${NC}"
echo ""
echo "Log directory: ${LOG_DIR}"
echo ""
# Show log menu
show_log_menu() {
clear
print_banner "Acronis Logs Viewer"
echo ""
echo -e "${BOLD}Available Logs:${NC}"
echo ""
# List all log files with sizes
if [ -d "$LOG_DIR" ]; then
local log_count=0
while IFS= read -r log_file; do
((log_count++))
local size=$(du -h "$log_file" 2>/dev/null | awk '{print $1}')
local filename=$(basename "$log_file")
local mod_time=$(stat -c %y "$log_file" 2>/dev/null | cut -d'.' -f1)
echo -e " ${CYAN}${log_count})${NC} ${filename}"
echo -e " Size: ${size} | Modified: ${mod_time}"
done < <(find "$LOG_DIR" -name "*.log" -type f | sort)
if [ $log_count -eq 0 ]; then
echo -e " ${DIM}No log files found${NC}"
fi
fi
echo ""
echo -e "${BOLD}Actions:${NC}"
echo ""
echo -e " ${GREEN}v)${NC} View Primary Log (last 100 lines)"
echo -e " ${GREEN}t)${NC} Tail Primary Log (live follow)"
echo -e " ${GREEN}s)${NC} Search Logs"
echo -e " ${GREEN}e)${NC} Show Errors Only"
echo -e " ${GREEN}a)${NC} Archive Old Logs"
echo ""
echo -e " ${RED}0)${NC} Return to Menu"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo -n "Select option: "
}
# View primary log
view_primary_log() {
clear
print_banner "Acronis Primary Log (Last 100 Lines)"
echo ""
if [ -f "$PRIMARY_LOG" ]; then
tail -100 "$PRIMARY_LOG"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
press_enter
else
print_error "Primary log file not found: $PRIMARY_LOG"
press_enter
fi
}
# Tail primary log
tail_primary_log() {
clear
print_banner "Acronis Live Log (Ctrl+C to Exit)"
echo ""
echo "Following: $PRIMARY_LOG"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
if [ -f "$PRIMARY_LOG" ]; then
tail -f "$PRIMARY_LOG"
else
print_error "Primary log file not found: $PRIMARY_LOG"
press_enter
fi
}
# Search logs
search_logs() {
clear
print_banner "Search Acronis Logs"
echo ""
echo -n "Enter search term: "
read -r search_term
if [ -z "$search_term" ]; then
print_error "No search term provided"
press_enter
return
fi
echo ""
echo "Searching for: ${search_term}"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
# Search all log files
local found=false
while IFS= read -r log_file; do
if grep -qi "$search_term" "$log_file" 2>/dev/null; then
found=true
echo -e "${BOLD}$(basename "$log_file"):${NC}"
grep -i --color=always "$search_term" "$log_file" | tail -20
echo ""
fi
done < <(find "$LOG_DIR" -name "*.log" -type f)
if [ "$found" = false ]; then
echo "No matches found for: $search_term"
fi
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
press_enter
}
# Show errors only
show_errors() {
clear
print_banner "Acronis Errors (Last 50)"
echo ""
if [ -f "$PRIMARY_LOG" ]; then
echo "Filtering for ERROR, WARN, FAIL, CRITICAL..."
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
grep -iE "error|warn|fail|critical" "$PRIMARY_LOG" | tail -50 | while IFS= read -r line; do
# Color code by severity
if echo "$line" | grep -qi "critical"; then
echo -e "${RED}${BOLD}${line}${NC}"
elif echo "$line" | grep -qi "error"; then
echo -e "${RED}${line}${NC}"
elif echo "$line" | grep -qi "warn"; then
echo -e "${YELLOW}${line}${NC}"
else
echo "$line"
fi
done
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
else
print_error "Primary log file not found"
fi
press_enter
}
# Archive old logs
archive_old_logs() {
clear
print_banner "Archive Old Logs"
echo ""
# Calculate total size
local total_size=$(du -sh "$LOG_DIR" 2>/dev/null | awk '{print $1}')
local log_count=$(find "$LOG_DIR" -name "*.log" -type f | wc -l)
echo "Current log status:"
echo " Directory: $LOG_DIR"
echo " Total size: $total_size"
echo " Log files: $log_count"
echo ""
# Find old logs (older than 30 days)
local old_logs=$(find "$LOG_DIR" -name "*.log" -type f -mtime +30 2>/dev/null | wc -l)
if [ $old_logs -eq 0 ]; then
echo -e "${GREEN}✓ No old logs found (>30 days)${NC}"
echo ""
press_enter
return
fi
echo "Found $old_logs log file(s) older than 30 days"
echo ""
echo "Archive location: /root/acronis-logs-archive-$(date +%Y%m%d).tar.gz"
echo ""
echo -n "Create archive and remove old logs? (yes/no): "
read -r confirm
if [ "$confirm" != "yes" ]; then
echo ""
echo "Archive cancelled"
press_enter
return
fi
echo ""
echo "→ Creating archive..."
# Create archive
local archive_name="/root/acronis-logs-archive-$(date +%Y%m%d).tar.gz"
if find "$LOG_DIR" -name "*.log" -type f -mtime +30 -print0 2>/dev/null | tar -czf "$archive_name" --null -T -; then
print_success "Archive created: $archive_name"
# Remove old logs
echo ""
echo "→ Removing old logs..."
find "$LOG_DIR" -name "*.log" -type f -mtime +30 -delete 2>/dev/null
local remaining=$(find "$LOG_DIR" -name "*.log" -type f | wc -l)
echo ""
print_success "Old logs archived and removed"
echo ""
echo "Remaining log files: $remaining"
else
print_error "Failed to create archive"
fi
echo ""
press_enter
}
# Main loop
while true; do
show_log_menu
read -r choice
case $choice in
v) view_primary_log ;;
t) tail_primary_log ;;
s) search_logs ;;
e) show_errors ;;
a) archive_old_logs ;;
0) exit 0 ;;
*)
# Check if numeric selection for specific log file
if [[ "$choice" =~ ^[0-9]+$ ]]; then
log_files=($(find "$LOG_DIR" -name "*.log" -type f | sort))
if [ $choice -gt 0 ] && [ $choice -le ${#log_files[@]} ]; then
selected_log="${log_files[$((choice-1))]}"
clear
print_banner "Log: $(basename "$selected_log")"
echo ""
tail -100 "$selected_log"
echo ""
press_enter
else
print_error "Invalid log selection"
sleep 1
fi
else
print_error "Invalid option"
sleep 1
fi
;;
esac
done
+42
View File
@@ -0,0 +1,42 @@
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$SCRIPT_DIR/lib/common-functions.sh"
if [ "$EUID" -ne 0 ]; then
print_error "This script must be run as root"
exit 1
fi
print_banner "Create Manual Backup"
echo ""
echo -e "${BOLD}Manual Backup Creation${NC}"
echo ""
echo "Manual backups are triggered through the Acronis web console or CLI."
echo ""
echo -e "${CYAN}Web Console Method (Recommended):${NC}"
echo ""
echo "1. Log in to Acronis web console"
echo "2. Go to: Devices → Select this server"
echo "3. Click 'Back up now' button"
echo "4. Monitor backup progress in real-time"
echo ""
echo -e "${CYAN}Command Line Method:${NC}"
echo ""
echo "Use the Acronis CLI tool (acrocmd):"
echo ""
echo " # List available plans"
echo " acrocmd list plans"
echo ""
echo " # Run backup for specific plan"
echo " acrocmd backup run --plan <plan_id>"
echo ""
echo " # Create ad-hoc backup"
echo " acrocmd backup create --source /path/to/data --destination /backup/path"
echo ""
echo -e "${BOLD}Note:${NC} Detailed CLI backup functionality can be added here based on"
echo "your specific requirements. Would you like me to implement the full"
echo "CLI backup interface?"
echo ""
press_enter
+210
View File
@@ -0,0 +1,210 @@
#!/bin/bash
################################################################################
# Acronis Plan Manager
################################################################################
# Purpose: Manage Acronis protection plans
# Features:
# - List protection plans
# - View plan details
# - Enable/disable plans
# - Guidance for plan configuration
################################################################################
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 "Protection Plan Management"
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 plans
echo -e "${BOLD}Current Protection Plans${NC}"
echo ""
plan_output=$(/usr/sbin/acrocmd list plans 2>&1)
if echo "$plan_output" | grep -qi "error\|no.*plans"; then
echo -e "${YELLOW}No protection plans configured${NC}"
HAS_PLANS=false
else
echo "$plan_output"
HAS_PLANS=true
fi
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
if [ "$HAS_PLANS" = true ]; then
echo -e "${BOLD}Plan Management Options${NC}"
echo ""
echo " 1) View detailed plan information"
echo " 2) Enable/disable plan"
echo " 3) Delete plan"
echo " 4) Create new plan (via web console)"
echo " 0) Return"
echo ""
echo -n "Select option [0]: "
read -r choice
choice="${choice:-0}"
case "$choice" in
1)
echo ""
echo -n "Enter plan ID or name: "
read -r plan_id
if [ -n "$plan_id" ]; then
echo ""
echo -e "${BOLD}Plan Details:${NC}"
echo ""
/usr/sbin/acrocmd show plan "$plan_id" 2>&1 || {
echo ""
print_error "Could not retrieve plan details"
echo "Check that the plan ID/name is correct"
}
fi
;;
2)
echo ""
echo -n "Enter plan ID to enable/disable: "
read -r plan_id
if [ -n "$plan_id" ]; then
echo ""
echo " 1) Enable plan"
echo " 2) Disable plan"
echo ""
echo -n "Select [1]: "
read -r action
action="${action:-1}"
if [ "$action" = "1" ]; then
/usr/sbin/acrocmd plan enable "$plan_id" 2>&1 && {
print_success "Plan enabled"
} || {
print_error "Failed to enable plan"
}
else
/usr/sbin/acrocmd plan disable "$plan_id" 2>&1 && {
print_success "Plan disabled"
} || {
print_error "Failed to disable plan"
}
fi
fi
;;
3)
echo ""
echo -e "${RED}${BOLD}Delete Protection Plan${NC}"
echo ""
echo -e "${YELLOW}Warning:${NC} This will delete the plan configuration."
echo "Existing backups will be retained."
echo ""
echo -n "Enter plan ID to delete: "
read -r plan_id
if [ -n "$plan_id" ]; then
echo ""
echo -n "Confirm deletion (type 'yes'): "
read -r confirm
if [ "$confirm" = "yes" ]; then
/usr/sbin/acrocmd delete plan "$plan_id" 2>&1 && {
print_success "Plan deleted"
} || {
print_error "Failed to delete plan"
}
else
echo "Cancelled"
fi
fi
;;
4)
echo ""
echo -e "${BOLD}Create New Protection Plan${NC}"
echo ""
echo "Protection plans are best created via the web console"
echo "for full configuration options and validation."
echo ""
echo -e "${CYAN}Web Console Method:${NC}"
echo ""
echo "1. Log in to Acronis web console"
# 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 'Add protection plan'"
echo "4. Configure plan settings:"
echo " • What to back up (entire system/volumes/files)"
echo " • Where to store (cloud/local)"
echo " • When to run (schedule)"
echo " • How long to keep (retention)"
echo "5. Save and activate"
echo ""
echo -e "${BOLD}Advanced CLI Method:${NC}"
echo ""
echo "For advanced users, plans can be created via acrocmd:"
echo " acrocmd create plan --help"
;;
esac
else
echo -e "${BOLD}Getting Started with Protection Plans${NC}"
echo ""
echo "Protection plans define your backup strategy:"
echo ""
echo -e "${CYAN}What:${NC} Files, folders, volumes, or entire system"
echo -e "${CYAN}Where:${NC} Cloud storage or local destination"
echo -e "${CYAN}When:${NC} Scheduled times (hourly/daily/weekly/monthly)"
echo -e "${CYAN}Keep:${NC} Retention policy (days/versions to keep)"
echo ""
echo -e "${BOLD}To Create Your First Plan:${NC}"
echo ""
echo "1. Log in to Acronis web console"
# 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 → This server"
echo "3. Click 'Add protection plan'"
echo "4. Follow the configuration wizard"
echo "5. Activate the plan"
echo ""
echo -e "${GREEN}Tip:${NC} Start with a simple file backup plan to test,"
echo " then create full system backup plans as needed."
fi
echo ""
press_enter
+231
View File
@@ -0,0 +1,231 @@
#!/bin/bash
################################################################################
# Acronis Agent Registration
################################################################################
# Purpose: Register Acronis agent with Acronis Cloud
# Command: /usr/lib/Acronis/RegisterAgentTool/RegisterAgent
# Flags:
# -o register - Operation: register
# -t cloud - Type: cloud-based
# -a <url> - Service URL
# --token <token> - Registration token
################################################################################
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$SCRIPT_DIR/lib/common-functions.sh"
source "$SCRIPT_DIR/lib/system-detect.sh"
# Require root
if [ "$EUID" -ne 0 ]; then
print_error "This script must be run as root"
exit 1
fi
print_banner "Acronis Agent Registration"
# Check if agent is installed
if [ ! -f "/usr/lib/Acronis/RegisterAgentTool/RegisterAgent" ]; then
echo ""
print_error "Acronis agent is not installed"
echo ""
echo "Please install the agent first:"
echo " 1. Return to Acronis Management menu"
echo " 2. Select 'Install Acronis Agent'"
echo ""
press_enter
exit 1
fi
echo ""
# Check current registration status
echo -e "${BOLD}Current Registration Status:${NC}"
echo ""
if [ -f "/etc/Acronis/Global.config" ]; then
if grep -q "CloudUrl" "/etc/Acronis/Global.config" 2>/dev/null; then
echo -e " ${GREEN}${NC} Agent is currently registered"
# Extract current cloud URL
current_url=$(grep -oP 'CloudUrl[>="].*?https://[^"<]+' /etc/Acronis/Global.config 2>/dev/null | grep -oP 'https://[^"<]+' | head -1)
if [ -n "$current_url" ]; then
echo -e " Current URL: ${current_url}"
fi
echo ""
echo -e "${YELLOW}⚠ Agent is already registered${NC}"
echo ""
echo "Do you want to:"
echo " 1) Keep current registration"
echo " 2) Re-register (will overwrite current registration)"
echo ""
echo -n "Select [1]: "
read -r choice
choice="${choice:-1}"
if [ "$choice" = "1" ]; then
echo ""
echo "Keeping current registration"
press_enter
exit 0
fi
echo ""
echo "Proceeding with re-registration..."
else
echo -e " ${YELLOW}${NC} Agent is not registered"
fi
else
echo -e " ${YELLOW}${NC} No configuration found"
fi
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
echo -e "${BOLD}Agent Registration${NC}"
echo ""
echo "You'll need:"
echo " • Acronis Cloud service URL (e.g., us5-cloud.acronis.com)"
echo " • Registration token from Acronis web console"
echo ""
echo "To get a registration token:"
echo " 1. Log in to Acronis web console"
echo " 2. Go to Settings → Registration tokens"
echo " 3. Create a new token or copy existing one"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
# Get service URL
echo -n "Enter Acronis Cloud service URL [us5-cloud.acronis.com]: "
read -r service_url
service_url="${service_url:-us5-cloud.acronis.com}"
# Validate URL format
if [[ ! "$service_url" =~ ^[a-z0-9.-]+\.acronis\.com$ ]]; then
print_error "Invalid service URL format"
echo ""
echo "Expected format: region-cloud.acronis.com"
echo "Examples:"
echo " • us5-cloud.acronis.com"
echo " • eu2-cloud.acronis.com"
echo " • ap1-cloud.acronis.com"
echo ""
press_enter
exit 1
fi
# Get registration token
echo ""
echo -n "Enter registration token: "
read -r reg_token
if [ -z "$reg_token" ]; then
print_error "Registration token is required"
press_enter
exit 1
fi
# Confirm registration
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
echo -e "${BOLD}Registration Summary:${NC}"
echo ""
echo " Service URL: https://${service_url}"
echo " Token: ${reg_token:0:8}...${reg_token: -4}"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
echo -n "Proceed with registration? (yes/no): "
read -r confirm
if [ "$confirm" != "yes" ]; then
echo ""
print_error "Registration cancelled"
press_enter
exit 0
fi
echo ""
echo -e "${BOLD}Registering Agent...${NC}"
echo ""
# Run registration command
REGISTER_CMD="/usr/lib/Acronis/RegisterAgentTool/RegisterAgent"
REGISTER_ARGS="-o register -t cloud -a https://${service_url} --token ${reg_token}"
echo "→ Contacting Acronis Cloud..."
echo ""
echo -e "${DIM}──────────────────────────────────────────────────────────────${NC}"
# Execute registration
if $REGISTER_CMD $REGISTER_ARGS; then
REG_EXIT_CODE=$?
else
REG_EXIT_CODE=$?
fi
echo -e "${DIM}──────────────────────────────────────────────────────────────${NC}"
echo ""
# Check result
if [ $REG_EXIT_CODE -eq 0 ]; then
print_success "Registration successful!"
echo ""
# Restart services to apply registration
echo "→ Restarting Acronis services..."
systemctl restart acronis_mms
systemctl restart aakore
sleep 2
if systemctl is-active --quiet acronis_mms; then
print_success "Services restarted successfully"
echo ""
echo -e "${BOLD}Agent Registered Successfully!${NC}"
echo ""
echo "Next steps:"
echo " 1. Log in to Acronis web console:"
echo " → https://${service_url}"
echo ""
echo " 2. Find this agent in the device list"
echo " → Navigate to: Devices → All devices"
echo ""
echo " 3. Assign backup plans to this agent"
echo " → Select device → Protection → Add plan"
echo ""
echo " 4. Check agent status from this toolkit"
echo " → Select 'Check Agent Status' from Acronis menu"
echo ""
else
print_error "Services failed to restart"
echo ""
echo "Registration may have succeeded but services need attention."
echo "Check logs: tail -f /var/lib/Acronis/BackupAndRecovery/MMS/mms.0.log"
echo ""
fi
else
print_error "Registration failed with exit code $REG_EXIT_CODE"
echo ""
echo "Common issues:"
echo " • Invalid registration token"
echo " • Incorrect service URL"
echo " • Network connectivity issues"
echo " • Firewall blocking connection to Acronis Cloud"
echo " • Token already used or expired"
echo ""
echo "Troubleshooting:"
echo " 1. Verify token in Acronis web console"
echo " 2. Check network connectivity:"
echo " curl -I https://${service_url}"
echo ""
echo " 3. Check agent logs:"
echo " tail -f /var/lib/Acronis/BackupAndRecovery/MMS/mms.0.log"
echo ""
fi
press_enter
+58
View File
@@ -0,0 +1,58 @@
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$SCRIPT_DIR/lib/common-functions.sh"
if [ "$EUID" -ne 0 ]; then
print_error "This script must be run as root"
exit 1
fi
print_banner "Restore from Backup"
echo ""
echo -e "${RED}${BOLD}⚠️ RESTORE OPERATION ⚠️${NC}"
echo ""
echo "Restoring from backups requires careful planning to avoid data loss."
echo ""
echo -e "${BOLD}Restore Methods:${NC}"
echo ""
echo -e "${CYAN}1. Web Console Method (Recommended)${NC}"
echo " • Most user-friendly with visual interface"
echo " • Full preview of backup contents"
echo " • Granular file/folder selection"
echo ""
echo " Steps:"
echo " a) Log in to Acronis web console"
echo " b) Navigate to: Backup → Recovery"
echo " c) Select backup archive"
echo " d) Choose recovery point (date/time)"
echo " e) Select files/folders to restore"
echo " f) Choose restore destination"
echo " g) Start recovery process"
echo ""
echo -e "${CYAN}2. Command Line Method${NC}"
echo " • For advanced users and automation"
echo " • Requires acrocmd CLI tool"
echo ""
echo " Basic syntax:"
echo " acrocmd recover --archive <archive_id> \\"
echo " --recoverypoint <point_id> \\"
echo " --destination /restore/path"
echo ""
echo -e "${CYAN}3. Bootable Media Recovery${NC}"
echo " • For full system disaster recovery"
echo " • Boot from Acronis bootable USB/ISO"
echo " • Restore entire system image"
echo ""
echo -e "${BOLD}Important Notes:${NC}"
echo ""
echo " ⚠ Test restores in a non-production environment first"
echo " ⚠ Verify backup integrity before critical restores"
echo " ⚠ Consider restoring to alternate location first"
echo " ⚠ Backup current data before overwriting"
echo ""
echo "Would you like me to implement an interactive restore wizard"
echo "with CLI backup browsing and restore capabilities?"
echo ""
press_enter
+109
View File
@@ -0,0 +1,109 @@
#!/bin/bash
################################################################################
# Acronis Schedule Viewer
################################################################################
# Purpose: View backup schedules and protection plans
# Features:
# - List all protection plans
# - Show backup schedules
# - Display plan details
################################################################################
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 "Backup Plans & Schedules"
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 protection plans
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo -e "${BOLD}Protection Plans${NC}"
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo ""
plan_output=$(/usr/sbin/acrocmd list plans 2>&1)
if echo "$plan_output" | grep -qi "error\|no.*plans"; then
echo -e "${YELLOW}No protection plans found${NC}"
echo ""
echo "Protection plans define what, when, and how to back up."
echo ""
echo -e "${BOLD}To Create Protection Plans:${NC}"
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 'Add protection plan'"
echo "4. Configure:"
echo " • Backup source (files/folders/volumes)"
echo " • Backup destination (cloud/local)"
echo " • Schedule (hourly/daily/weekly/monthly)"
echo " • Retention policy"
echo "5. Save and activate plan"
else
echo "$plan_output"
fi
echo ""
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo ""
# Check schedule status from service
echo -e "${BOLD}Schedule Service Status${NC}"
echo ""
if systemctl is-active --quiet acronis_schedule 2>/dev/null; then
echo -e "${GREEN}${NC} Acronis scheduler is running"
# Show recent schedule events from log
if [ -f "/var/lib/Acronis/BackupAndRecovery/scheduler.log" ]; then
echo ""
echo "Recent scheduler activity:"
echo ""
tail -5 /var/lib/Acronis/BackupAndRecovery/scheduler.log 2>/dev/null | while read -r line; do
echo " $line"
done
fi
else
echo -e "${YELLOW}${NC} Acronis scheduler is not running"
echo ""
echo "Start it with: systemctl start acronis_schedule"
fi
echo ""
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo ""
echo -e "${BOLD}Next Steps:${NC}"
echo ""
echo " • Trigger manual backup: Select 'Trigger Manual Backup'"
echo " • Manage plans: Select 'Manage Protection Plans'"
echo " • Check status: Select 'Check Backup Status'"
echo ""
press_enter
+45
View File
@@ -0,0 +1,45 @@
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$SCRIPT_DIR/lib/common-functions.sh"
if [ "$EUID" -ne 0 ]; then
print_error "This script must be run as root"
exit 1
fi
print_banner "View Backup Status"
echo ""
echo -e "${BOLD}Acronis Backup Status${NC}"
echo ""
echo "Checking backup status..."
echo ""
# Check if acrocmd exists
if ! command -v acrocmd &>/dev/null; then
echo -e "${YELLOW}acrocmd CLI tool not found${NC}"
echo ""
echo "Backup status is available through:"
echo " • Acronis web console (real-time status)"
echo " • Agent logs (see 'View Logs' option)"
echo ""
echo "To use CLI: acrocmd may need to be installed separately"
echo ""
press_enter
exit 0
fi
# Show recent backup activities from logs
if [ -f "/var/lib/Acronis/BackupAndRecovery/MMS/mms.0.log" ]; then
echo -e "${BOLD}Recent Backup Activity:${NC}"
echo ""
grep -i "backup.*completed\|backup.*started\|backup.*failed" /var/lib/Acronis/BackupAndRecovery/MMS/mms.0.log 2>/dev/null | tail -10
echo ""
fi
echo "For detailed status, use:"
echo " • Web console: Full backup history and status"
echo " • acrocmd: Command-line status queries"
echo ""
press_enter
+202
View File
@@ -0,0 +1,202 @@
#!/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)
# Check if no plans exist (empty output or success message only)
if echo "$plan_output" | grep -qi "error\|failed\|no plans" || ! echo "$plan_output" | grep -q "[a-f0-9]\{8\}-[a-f0-9]\{4\}"; then
echo -e "${YELLOW}No backup plans found or error querying plans${NC}"
echo ""
echo "Possible reasons:"
echo " • No CLI-managed plans exist (acrocmd only shows local plans)"
echo " • Cloud-managed plans created in web console are not visible here"
echo " • Agent not registered with Acronis Cloud"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
echo -e "${BOLD}Important Note:${NC}"
echo ""
echo "Plans created in the Acronis web console are managed at the cloud level"
echo "and are NOT accessible via the acrocmd CLI tool. The CLI can only see and"
echo "manage plans created locally via acrocmd commands."
echo ""
echo -e "${BOLD}To Trigger Cloud-Managed Backups:${NC}"
echo ""
echo "1. Log in to Acronis web console"
echo "2. Navigate to: Devices → Select this server"
echo "3. Click 'Back up now' to trigger your existing plan"
echo ""
echo -e "${BOLD}To Create CLI-Managed Plans:${NC}"
echo ""
echo "Use: acrocmd create plan --help"
echo "Note: CLI plans give you more control and optimization options"
echo ""
press_enter
exit 0
fi
echo "$plan_output"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
echo -e "${BOLD}Select a Plan to Backup:${NC}"
echo ""
echo "Enter the plan name or ID from the list above,"
echo "or press Enter to cancel and use web console instead."
echo ""
echo -n "Plan name/ID: "
read -r plan_id
if [ -z "$plan_id" ]; then
echo ""
echo -e "${BOLD}Use Web Console Instead${NC}"
echo ""
echo "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 → This server"
echo "3. Click 'Back up now' button"
echo "4. Monitor progress in real-time"
echo ""
press_enter
exit 0
fi
# User selected a plan, proceed with backup type selection
echo ""
echo -e "${BOLD}Backup Type Selection${NC}"
echo ""
echo "Select backup type:"
echo " 1) Auto (use plan's configured type)"
echo " 2) Full backup"
echo " 3) Incremental backup"
echo " 4) Differential backup"
echo ""
echo -n "Select type [1]: "
read -r backup_type_choice
backup_type_choice="${backup_type_choice:-1}"
BACKUP_FLAGS=""
case "$backup_type_choice" in
2)
BACKUP_FLAGS="--backuptype=full"
echo " → Full backup selected"
;;
3)
BACKUP_FLAGS="--backuptype=incremental"
echo " → Incremental backup selected (faster, stores only changes)"
;;
4)
BACKUP_FLAGS="--backuptype=differential"
echo " → Differential backup selected (changes since last full)"
;;
*)
echo " → Using plan's default backup type"
;;
esac
echo ""
echo -e "${BOLD}Performance Options${NC}"
echo ""
echo -n "Enable performance optimizations? (y/n) [n]: "
read -r opt_choice
if [ "$opt_choice" = "y" ] || [ "$opt_choice" = "Y" ]; then
echo ""
echo "Available optimizations:"
echo " 1) Lower compression (faster backup, larger size)"
echo " 2) High priority (use more system resources)"
echo " 3) Both"
echo ""
echo -n "Select [3]: "
read -r perf_choice
perf_choice="${perf_choice:-3}"
case "$perf_choice" in
1)
BACKUP_FLAGS="$BACKUP_FLAGS --compression=normal"
echo " → Lower compression enabled"
;;
2)
BACKUP_FLAGS="$BACKUP_FLAGS --priority=high"
echo " → High priority enabled"
;;
3)
BACKUP_FLAGS="$BACKUP_FLAGS --compression=normal --priority=high"
echo " → Lower compression + high priority enabled"
;;
esac
fi
echo ""
echo -e "${BOLD}Starting Backup...${NC}"
echo ""
echo "Plan: $plan_id"
[ -n "$BACKUP_FLAGS" ] && echo "Options: $BACKUP_FLAGS"
echo ""
# Try to run backup
if /usr/sbin/acrocmd backup run --plan "$plan_id" $BACKUP_FLAGS 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
echo ""
press_enter
+471
View File
@@ -0,0 +1,471 @@
#!/bin/bash
################################################################################
# Acronis Backup Troubleshooter
################################################################################
# Purpose: Diagnose and troubleshoot Acronis backup failures
# Features:
# - Multi-log location scanning
# - Common failure pattern detection
# - Service health checks
# - Disk space analysis
# - Network connectivity tests
# - Automated fix suggestions
################################################################################
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$SCRIPT_DIR/lib/common-functions.sh"
source "$SCRIPT_DIR/lib/system-detect.sh"
# Require root
if [ "$EUID" -ne 0 ]; then
print_error "This script must be run as root"
exit 1
fi
# Log locations to check
declare -A LOG_LOCATIONS=(
["MMS"]="/var/lib/Acronis/BackupAndRecovery/MMS/mms.0.log"
["MMS_OLD"]="/var/lib/Acronis/BackupAndRecovery/MMS/mms.*.log"
["AGENT"]="/var/log/acronis/agent/*.log"
["CORE"]="/var/lib/Acronis/BackupAndRecovery/aakore.log"
["SCHEDULE"]="/var/lib/Acronis/BackupAndRecovery/scheduler.log"
["SYSTEM"]="/var/log/messages"
["SYSLOG"]="/var/log/syslog"
)
print_banner "Acronis Backup Troubleshooter"
echo ""
echo -e "${BOLD}Diagnostic Mode${NC}"
echo ""
echo "This tool will analyze:"
echo " • Service status and health"
echo " • Log files for errors and failures"
echo " • System resources (disk, memory)"
echo " • Network connectivity to Acronis Cloud"
echo " • Common backup failure patterns"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
# Track issues found
declare -a ISSUES_FOUND=()
declare -a WARNINGS_FOUND=()
declare -a RECOMMENDATIONS=()
# Function to add issue
add_issue() {
ISSUES_FOUND+=("$1")
}
# Function to add warning
add_warning() {
WARNINGS_FOUND+=("$1")
}
# Function to add recommendation
add_recommendation() {
RECOMMENDATIONS+=("$1")
}
# 1. Check service status
echo -e "${BOLD}[1/7] Checking Acronis Services...${NC}"
echo ""
declare -a SERVICES=("aakore" "acronis_mms" "acronis_schedule" "active-protection")
all_services_running=true
for service in "${SERVICES[@]}"; do
if systemctl list-unit-files | grep -q "^${service}.service"; then
if systemctl is-active --quiet "$service"; then
echo -e " ${GREEN}${NC} $service is running"
else
echo -e " ${RED}${NC} $service is NOT running"
add_issue "Service $service is stopped"
add_recommendation "Start service: systemctl start $service"
all_services_running=false
fi
fi
done
if [ "$all_services_running" = false ]; then
add_recommendation "Start all services: Go to Acronis menu → Check Agent Status → Start All Services"
fi
echo ""
# 2. Check disk space
echo -e "${BOLD}[2/7] Checking Disk Space...${NC}"
echo ""
# Check backup directory
if [ -d "/var/lib/Acronis" ]; then
backup_disk_usage=$(df -h /var/lib/Acronis | tail -1 | awk '{print $5}' | tr -d '%')
backup_disk_avail=$(df -h /var/lib/Acronis | tail -1 | awk '{print $4}')
echo " Acronis directory: /var/lib/Acronis"
echo " Disk usage: ${backup_disk_usage}%"
echo " Available: ${backup_disk_avail}"
if [ "$backup_disk_usage" -gt 95 ]; then
add_issue "Disk space critically low (${backup_disk_usage}% used)"
add_recommendation "Free up disk space or change backup destination"
elif [ "$backup_disk_usage" -gt 90 ]; then
add_warning "Disk space running low (${backup_disk_usage}% used)"
add_recommendation "Monitor disk space closely"
else
echo -e " ${GREEN}${NC} Disk space OK"
fi
fi
# Check system disk
root_disk_usage=$(df -h / | tail -1 | awk '{print $5}' | tr -d '%')
if [ "$root_disk_usage" -gt 90 ]; then
add_warning "Root filesystem at ${root_disk_usage}% capacity"
fi
echo ""
# 3. Check memory
echo -e "${BOLD}[3/7] Checking Memory...${NC}"
echo ""
mem_total=$(free -h | grep "^Mem:" | awk '{print $2}')
mem_available=$(free -h | grep "^Mem:" | awk '{print $7}')
mem_used_percent=$(free | grep "^Mem:" | awk '{printf "%.0f", ($3/$2)*100}')
echo " Total memory: ${mem_total}"
echo " Available: ${mem_available}"
echo " Used: ${mem_used_percent}%"
if [ "$mem_used_percent" -gt 95 ]; then
add_warning "Memory usage critically high (${mem_used_percent}%)"
add_recommendation "Check for memory leaks or reduce backup concurrency"
elif [ "$mem_used_percent" -gt 90 ]; then
add_warning "Memory usage high (${mem_used_percent}%)"
else
echo -e " ${GREEN}${NC} Memory OK"
fi
echo ""
# 4. Check network connectivity
echo -e "${BOLD}[4/7] Checking Network Connectivity...${NC}"
echo ""
# Check if registered
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 " Testing connection to: $cloud_url"
# Extract hostname
cloud_host=$(echo "$cloud_url" | sed 's|https://||' | sed 's|/.*||')
# Test connectivity
if curl -s --connect-timeout 5 -I "$cloud_url" >/dev/null 2>&1; then
echo -e " ${GREEN}${NC} Connection successful"
else
add_issue "Cannot connect to Acronis Cloud: $cloud_url"
add_recommendation "Check firewall rules and network connectivity"
add_recommendation "Test manually: curl -I $cloud_url"
fi
# Test DNS resolution
if host "$cloud_host" >/dev/null 2>&1; then
echo -e " ${GREEN}${NC} DNS resolution OK"
else
add_issue "DNS resolution failed for $cloud_host"
add_recommendation "Check DNS configuration: /etc/resolv.conf"
fi
else
add_warning "Agent may not be registered with Acronis Cloud"
add_recommendation "Register agent: Acronis menu → Register with Cloud"
fi
else
add_warning "Acronis configuration file not found"
fi
echo ""
# 5. Scan logs for errors
echo -e "${BOLD}[5/7] Scanning Logs for Errors...${NC}"
echo ""
# Common error patterns
declare -A ERROR_PATTERNS=(
["INSUFFICIENT_SPACE"]="insufficient.*space|no.*space.*left|disk.*full"
["PERMISSION_DENIED"]="permission.*denied|access.*denied|cannot.*access"
["CONNECTION_FAILED"]="connection.*failed|connection.*refused|timeout|network.*error"
["AUTH_FAILED"]="authentication.*failed|invalid.*credentials|unauthorized"
["BACKUP_FAILED"]="backup.*failed|backup.*error|task.*failed"
["VSS_ERROR"]="vss.*error|snapshot.*failed|shadow.*copy.*error"
["DATABASE_ERROR"]="database.*error|sql.*error|db.*lock"
["FILE_LOCKED"]="file.*locked|file.*in.*use|sharing.*violation"
)
# Scan primary log
primary_log="/var/lib/Acronis/BackupAndRecovery/MMS/mms.0.log"
if [ -f "$primary_log" ]; then
echo " Scanning primary log: mms.0.log"
for pattern_name in "${!ERROR_PATTERNS[@]}"; do
pattern="${ERROR_PATTERNS[$pattern_name]}"
if grep -iE "$pattern" "$primary_log" 2>/dev/null | tail -1 | grep -q .; then
error_count=$(grep -icE "$pattern" "$primary_log" 2>/dev/null)
last_error=$(grep -iE "$pattern" "$primary_log" 2>/dev/null | tail -1)
echo -e " ${RED}${NC} Found $pattern_name errors (count: $error_count)"
echo -e " Last: ${DIM}${last_error:0:80}...${NC}"
add_issue "$pattern_name detected in logs (count: $error_count)"
# Add specific recommendations
case "$pattern_name" in
"INSUFFICIENT_SPACE")
add_recommendation "Free up disk space or change backup destination"
;;
"PERMISSION_DENIED")
add_recommendation "Check file/directory permissions"
add_recommendation "Ensure Acronis agent has necessary access rights"
;;
"CONNECTION_FAILED")
add_recommendation "Check network connectivity and firewall rules"
add_recommendation "Verify Acronis Cloud URL is accessible"
;;
"AUTH_FAILED")
add_recommendation "Re-register agent with valid token"
add_recommendation "Check registration status in web console"
;;
"VSS_ERROR")
add_recommendation "Check VSS service: vssadmin list writers"
add_recommendation "Restart VSS: net stop vss && net start vss"
;;
"DATABASE_ERROR")
add_recommendation "Check database connections and locks"
add_recommendation "Consider application-aware backup settings"
;;
"FILE_LOCKED")
add_recommendation "Identify processes locking files: lsof"
add_recommendation "Schedule backups during low-activity periods"
;;
esac
fi
done
# Check for recent backup failures
recent_failures=$(grep -i "backup.*failed\|task.*failed" "$primary_log" 2>/dev/null | tail -5)
if [ -n "$recent_failures" ]; then
echo ""
echo -e " ${YELLOW}Recent backup failures:${NC}"
echo "$recent_failures" | while read -r line; do
echo -e " ${DIM}${line:0:100}${NC}"
done
fi
else
add_warning "Primary log file not found: $primary_log"
fi
echo ""
# 6. Check for stuck backups
echo -e "${BOLD}[6/7] Checking for Stuck Processes...${NC}"
echo ""
# Check for long-running Acronis processes
old_processes=$(ps aux | grep -i acronis | grep -v grep | awk '{if ($10 ~ /[0-9][0-9]:[0-9][0-9]/) print $0}')
if [ -n "$old_processes" ]; then
echo -e " ${YELLOW}${NC} Long-running Acronis processes detected:"
echo "$old_processes" | while read -r line; do
echo -e " ${DIM}$line${NC}"
done
add_warning "Long-running Acronis processes may indicate stuck backups"
add_recommendation "Review processes and consider restarting services if stuck"
else
echo -e " ${GREEN}${NC} No stuck processes detected"
fi
echo ""
# 7. Check configuration issues
echo -e "${BOLD}[7/7] Checking Configuration...${NC}"
echo ""
# Check if backup plans are configured
if command -v acrocmd &>/dev/null; then
plan_count=$(acrocmd list plans 2>/dev/null | grep -c "^Plan ID" || echo "0")
echo " Configured backup plans: $plan_count"
if [ "$plan_count" -eq 0 ]; then
add_warning "No backup plans configured"
add_recommendation "Configure backup plans in Acronis web console"
fi
else
echo " ${DIM}acrocmd not available - cannot check backup plans${NC}"
fi
# Check agent version
if [ -f "/usr/lib/Acronis/BackupAndRecovery/aakore" ]; then
agent_version=$(/usr/lib/Acronis/BackupAndRecovery/aakore --version 2>/dev/null | head -1 || echo "Unknown")
echo " Agent version: $agent_version"
else
add_warning "Cannot determine agent version"
fi
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
# Summary Report
echo -e "${BOLD}DIAGNOSTIC SUMMARY${NC}"
echo ""
if [ ${#ISSUES_FOUND[@]} -eq 0 ] && [ ${#WARNINGS_FOUND[@]} -eq 0 ]; then
echo -e "${GREEN}${BOLD}✓ No issues detected${NC}"
echo ""
echo "Acronis appears to be healthy. If you're experiencing backup"
echo "failures, check the web console for detailed backup logs."
else
# Show issues
if [ ${#ISSUES_FOUND[@]} -gt 0 ]; then
echo -e "${RED}${BOLD}Critical Issues (${#ISSUES_FOUND[@]}):${NC}"
for issue in "${ISSUES_FOUND[@]}"; do
echo -e " ${RED}${NC} $issue"
done
echo ""
fi
# Show warnings
if [ ${#WARNINGS_FOUND[@]} -gt 0 ]; then
echo -e "${YELLOW}${BOLD}Warnings (${#WARNINGS_FOUND[@]}):${NC}"
for warning in "${WARNINGS_FOUND[@]}"; do
echo -e " ${YELLOW}${NC} $warning"
done
echo ""
fi
# Show recommendations
if [ ${#RECOMMENDATIONS[@]} -gt 0 ]; then
echo -e "${CYAN}${BOLD}Recommendations:${NC}"
local rec_num=1
for rec in "${RECOMMENDATIONS[@]}"; do
echo -e " ${CYAN}${rec_num}.${NC} $rec"
((rec_num++))
done
echo ""
fi
fi
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
# Quick actions
echo -e "${BOLD}Quick Actions:${NC}"
echo ""
echo -e " ${CYAN}1)${NC} View Full Logs (all errors)"
echo -e " ${CYAN}2)${NC} Restart All Services"
echo -e " ${CYAN}3)${NC} Generate Detailed Report"
echo -e " ${CYAN}4)${NC} Export Logs for Support"
echo ""
echo -e " ${RED}0)${NC} Return to Menu"
echo ""
echo -n "Select action (or press Enter to return): "
read -r action
case "$action" in
1)
# Show all errors
clear
print_banner "All Errors from Logs"
echo ""
if [ -f "$primary_log" ]; then
grep -iE "error|fail|critical|warn" "$primary_log" | tail -50
fi
echo ""
press_enter
;;
2)
# Restart services
echo ""
echo "Restarting all Acronis services..."
systemctl restart aakore
systemctl restart acronis_mms
systemctl restart acronis_schedule
systemctl restart active-protection
echo ""
print_success "Services restarted"
echo ""
echo "Waiting 5 seconds for services to stabilize..."
sleep 5
echo ""
echo "Running diagnostic again..."
sleep 2
exec "$0"
;;
3)
# Generate detailed report
report_file="/tmp/acronis-diagnostic-$(date +%Y%m%d-%H%M%S).txt"
echo ""
echo "Generating detailed report..."
{
echo "Acronis Diagnostic Report"
echo "Generated: $(date)"
echo "Hostname: $(hostname)"
echo ""
echo "=== Service Status ==="
for service in "${SERVICES[@]}"; do
systemctl status "$service" 2>&1 | head -20
echo ""
done
echo ""
echo "=== Recent Log Entries ==="
if [ -f "$primary_log" ]; then
tail -200 "$primary_log"
fi
echo ""
echo "=== System Resources ==="
df -h
echo ""
free -h
echo ""
echo "=== Network ==="
netstat -tuln | grep -E "7770|7800|8443|44445"
echo ""
echo "=== Processes ==="
ps aux | grep -i acronis | grep -v grep
} > "$report_file"
print_success "Report generated: $report_file"
echo ""
echo "You can send this report to Acronis support or review it locally."
echo ""
press_enter
;;
4)
# Export logs
archive_file="/tmp/acronis-logs-$(date +%Y%m%d-%H%M%S).tar.gz"
echo ""
echo "Exporting logs..."
if [ -d "/var/lib/Acronis/BackupAndRecovery/MMS" ]; then
tar -czf "$archive_file" /var/lib/Acronis/BackupAndRecovery/MMS/*.log 2>/dev/null
print_success "Logs exported: $archive_file"
echo ""
echo "Archive size: $(du -h "$archive_file" | awk '{print $1}')"
else
print_error "Log directory not found"
fi
echo ""
press_enter
;;
*)
exit 0
;;
esac
+249
View File
@@ -0,0 +1,249 @@
#!/bin/bash
################################################################################
# Acronis Agent Uninstaller
################################################################################
# Purpose: Safely uninstall Acronis Cyber Protect agent
# Process:
# 1. Stop all Acronis services
# 2. Unregister from cloud (optional)
# 3. Remove Acronis packages
# 4. Clean up data directories (optional)
################################################################################
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$SCRIPT_DIR/lib/common-functions.sh"
source "$SCRIPT_DIR/lib/system-detect.sh"
# Require root
if [ "$EUID" -ne 0 ]; then
print_error "This script must be run as root"
exit 1
fi
print_banner "Acronis Agent Uninstaller"
# Check if Acronis is installed
if ! systemctl list-unit-files | grep -q "acronis_mms.service"; then
echo ""
echo -e "${YELLOW}⚠ Acronis Not Installed${NC}"
echo ""
echo "Acronis Cyber Protect does not appear to be installed on this system."
echo ""
press_enter
exit 0
fi
echo ""
echo -e "${RED}${BOLD}⚠️ WARNING ⚠️${NC}"
echo ""
echo "This will completely remove Acronis Cyber Protect from this system."
echo ""
echo -e "${BOLD}What will be removed:${NC}"
echo " • All Acronis services (aakore, mms, schedule, active-protection)"
echo " • Acronis software packages"
echo " • Agent registration (if selected)"
echo " • Backup data and logs (if selected)"
echo ""
echo -e "${RED}This action cannot be easily undone!${NC}"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
# Confirm uninstallation
echo -n "Type 'uninstall' to confirm removal: "
read -r confirm
if [ "$confirm" != "uninstall" ]; then
echo ""
print_error "Uninstallation cancelled"
press_enter
exit 0
fi
echo ""
echo -e "${BOLD}Uninstallation Options:${NC}"
echo ""
# Ask about data retention
echo -n "Remove backup data and logs? (yes/no) [no]: "
read -r remove_data
remove_data="${remove_data:-no}"
echo ""
echo -n "Unregister from Acronis Cloud? (yes/no) [yes]: "
read -r unregister
unregister="${unregister:-yes}"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
echo -e "${BOLD}Uninstallation Summary:${NC}"
echo ""
echo " Stop services: Yes"
echo " Remove software: Yes"
echo " Unregister agent: ${unregister}"
echo " Remove data/logs: ${remove_data}"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
echo -n "Proceed with uninstallation? (yes/no): "
read -r final_confirm
if [ "$final_confirm" != "yes" ]; then
echo ""
print_error "Uninstallation cancelled"
press_enter
exit 0
fi
echo ""
echo -e "${BOLD}Starting Uninstallation...${NC}"
echo ""
# Stop all services
echo "→ Stopping Acronis services..."
systemctl stop active-protection.service 2>/dev/null
systemctl stop acronis_schedule 2>/dev/null
systemctl stop acronis_mms 2>/dev/null
systemctl stop aakore 2>/dev/null
service acronis_mms stop 2>/dev/null
sleep 2
if systemctl is-active --quiet acronis_mms; then
print_error "Warning: Some services may still be running"
else
print_success "Services stopped"
fi
echo ""
# Unregister from cloud if requested
if [ "$unregister" = "yes" ]; then
echo "→ Unregistering from Acronis Cloud..."
if [ -f "/usr/lib/Acronis/RegisterAgentTool/RegisterAgent" ]; then
if /usr/lib/Acronis/RegisterAgentTool/RegisterAgent -o unregister 2>/dev/null; then
print_success "Agent unregistered"
else
echo " ${YELLOW}Note: Unregistration may have failed (continuing anyway)${NC}"
fi
else
echo " ${YELLOW}Note: Registration tool not found (skipping)${NC}"
fi
echo ""
fi
# Disable services
echo "→ Disabling Acronis services..."
systemctl disable aakore 2>/dev/null
systemctl disable acronis_mms 2>/dev/null
systemctl disable acronis_schedule 2>/dev/null
systemctl disable active-protection.service 2>/dev/null
echo " ${GREEN}${NC} Services disabled"
echo ""
# Remove packages
echo "→ Removing Acronis packages..."
# Try different package managers
if command -v dpkg &>/dev/null; then
# Debian/Ubuntu
dpkg -l | grep -i acronis | awk '{print $2}' | while read -r pkg; do
echo " Removing: $pkg"
dpkg --purge "$pkg" 2>/dev/null
done
elif command -v rpm &>/dev/null; then
# RedHat/CentOS
rpm -qa | grep -i acronis | while read -r pkg; do
echo " Removing: $pkg"
rpm -e "$pkg" 2>/dev/null
done
fi
print_success "Packages removed"
echo ""
# Remove data directories if requested
if [ "$remove_data" = "yes" ]; then
echo "→ Removing Acronis data and logs..."
declare -a DATA_DIRS=(
"/var/lib/Acronis"
"/usr/lib/Acronis"
"/etc/Acronis"
"/opt/acronis"
)
for dir in "${DATA_DIRS[@]}"; do
if [ -d "$dir" ]; then
local size=$(du -sh "$dir" 2>/dev/null | awk '{print $1}')
echo " Removing: $dir (${size})"
rm -rf "$dir" 2>/dev/null
fi
done
print_success "Data directories removed"
echo ""
fi
# Clean up systemd
echo "→ Cleaning up system configuration..."
systemctl daemon-reload
echo " ${GREEN}${NC} systemd reloaded"
echo ""
# Final verification
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
echo -e "${GREEN}${BOLD}✓ Uninstallation Complete${NC}"
echo ""
# Check if anything remains
local remaining=0
if systemctl list-unit-files | grep -q "acronis"; then
echo -e "${YELLOW}⚠ Some service files may still be present${NC}"
((remaining++))
fi
if [ -d "/var/lib/Acronis" ] || [ -d "/usr/lib/Acronis" ]; then
echo -e "${YELLOW}⚠ Some directories were not removed${NC}"
((remaining++))
fi
if [ $remaining -eq 0 ]; then
echo "Acronis Cyber Protect has been completely removed from this system."
else
echo ""
echo "Uninstallation mostly complete, but some files may remain."
echo "This is usually safe and won't affect system operation."
fi
echo ""
# Show what was kept
if [ "$remove_data" = "no" ]; then
echo -e "${BOLD}Retained Data:${NC}"
echo ""
echo "Backup data and logs were kept as requested:"
if [ -d "/var/lib/Acronis" ]; then
local data_size=$(du -sh /var/lib/Acronis 2>/dev/null | awk '{print $1}')
echo " Location: /var/lib/Acronis"
echo " Size: $data_size"
echo ""
echo "To remove this data later:"
echo " rm -rf /var/lib/Acronis"
fi
echo ""
fi
echo "To reinstall Acronis in the future:"
echo " 1. Return to Backup & Recovery menu"
echo " 2. Select 'Acronis Management'"
echo " 3. Choose 'Install Acronis Agent'"
echo ""
press_enter
+314
View File
@@ -0,0 +1,314 @@
#!/bin/bash
################################################################################
# Acronis Agent Update/Upgrade
################################################################################
# Purpose: Update Acronis Cyber Protect agent to latest version
# Methods:
# - Automatic via cloud (web console)
# - Manual download and upgrade (preserves config/registration)
################################################################################
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
print_banner "Update Acronis Agent"
echo ""
# Check if Acronis is installed
if ! systemctl list-unit-files | grep -q "acronis_mms.service"; then
print_error "Acronis is not installed"
echo ""
echo "Install Acronis first:"
echo " 1. Return to Acronis menu"
echo " 2. Select 'Install Acronis Agent'"
echo ""
press_enter
exit 1
fi
echo -e "${BOLD}Current Installation${NC}"
echo ""
# Check current version
echo "→ Checking current agent version..."
if [ -f "/usr/lib/Acronis/BackupAndRecovery/aakore" ]; then
current_version=$(/usr/lib/Acronis/BackupAndRecovery/aakore --version 2>/dev/null | head -1 || echo "Unknown")
echo " Current version: ${current_version}"
else
echo " ${YELLOW}Version unknown${NC}"
fi
# Check service status
echo ""
echo "→ Service status:"
if systemctl is-active --quiet acronis_mms; then
echo " ${GREEN}${NC} Services are running"
else
echo " ${YELLOW}${NC} Some services are stopped"
fi
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
echo -e "${BOLD}Update Methods${NC}"
echo ""
echo -e "${CYAN}1. Automatic Update (via Acronis Cloud)${NC}"
echo " • Managed from web console"
echo " • Navigate to: Settings → Agent updates"
echo " • Can enable automatic updates"
echo " • Recommended for production environments"
echo ""
echo -e "${CYAN}2. Manual Update (Download + Upgrade)${NC}"
echo " • Downloads latest installer"
echo " • Runs upgrade automatically"
echo " • Preserves configuration and registration"
echo " • Agent stays registered to same account"
echo ""
echo -n "Select update method (1/2) or 0 to cancel [2]: "
read -r method
method="${method:-2}"
case "$method" in
1)
# Automatic update instructions
clear
print_banner "Automatic Agent Updates"
echo ""
echo -e "${BOLD}Configure Automatic Updates via Web Console${NC}"
echo ""
echo "Steps:"
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: Settings → Agent updates"
echo ""
echo " 3. Options available:"
echo " • Enable automatic updates"
echo " • Schedule update time"
echo " • Set update policy per device"
echo " • Configure notification preferences"
echo ""
echo " 4. Agents will update during maintenance window"
echo ""
echo -e "${GREEN}Benefits:${NC}"
echo " ✓ Centrally managed"
echo " ✓ Scheduled updates"
echo " ✓ Rollback capability"
echo " ✓ Update verification"
echo ""
press_enter
;;
2)
# Manual update/upgrade
clear
print_banner "Manual Agent Upgrade"
echo ""
echo -e "${BOLD}Upgrade Process${NC}"
echo ""
echo "This will:"
echo " 1. Download the latest Acronis agent installer"
echo " 2. Run installer over existing installation"
echo " 3. Automatically upgrade to latest version"
echo " 4. Preserve all configuration and registration"
echo " 5. Restart services with new version"
echo ""
echo -e "${YELLOW}Note:${NC} The agent will stay registered to your Acronis account."
echo " No need to re-register after upgrade."
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo ""
# Get cloud URL for download
SERVICE_URL="us5-cloud.acronis.com"
if [ -f "/etc/Acronis/Global.config" ]; then
config_url=$(grep -oP 'CloudUrl[>="].*?https://[^"<]+' /etc/Acronis/Global.config 2>/dev/null | grep -oP 'https://[^"<]+' | head -1)
if [ -n "$config_url" ]; then
SERVICE_URL=$(echo "$config_url" | sed 's|https://||' | sed 's|/.*||')
fi
fi
echo "Download region: ${SERVICE_URL}"
echo ""
echo -n "Proceed with upgrade? (yes/no): "
read -r confirm
if [[ ! "$confirm" =~ ^[Yy]([Ee][Ss])?$ ]]; then
echo ""
print_error "Upgrade cancelled"
press_enter
exit 0
fi
echo ""
echo -e "${BOLD}Starting Upgrade...${NC}"
echo ""
# Create download directory
DOWNLOAD_DIR="$SCRIPT_DIR/downloads"
mkdir -p "$DOWNLOAD_DIR"
cd "$DOWNLOAD_DIR" || exit 1
INSTALL_DIR="$DOWNLOAD_DIR/acronis-upgrade-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$INSTALL_DIR"
cd "$INSTALL_DIR" || exit 1
# Download installer
echo "→ Downloading latest Acronis agent..."
DOWNLOAD_URL="https://${SERVICE_URL}/bc/api/ams/links/agents/redirect?language=multi&system=linux&architecture=64&productType=enterprise"
if wget -q --show-progress "$DOWNLOAD_URL" -O "Cyber_Protection_Agent_for_Linux_x86_64.bin"; then
print_success "Download complete"
else
print_error "Download failed"
echo ""
echo "Possible causes:"
echo " • No internet connection"
echo " • Invalid service URL"
echo " • Firewall blocking connection"
echo ""
cd "$SCRIPT_DIR"
rm -rf "$INSTALL_DIR"
press_enter
exit 1
fi
echo ""
# Make executable
chmod +x "Cyber_Protection_Agent_for_Linux_x86_64.bin" 2>/dev/null
# Verify file
file_size=$(stat -c%s "Cyber_Protection_Agent_for_Linux_x86_64.bin" 2>/dev/null || echo "0")
if [ "$file_size" -lt 1000000 ]; then
print_error "Downloaded file is too small (possibly corrupted)"
cd "$SCRIPT_DIR"
rm -rf "$INSTALL_DIR"
press_enter
exit 1
fi
# Run upgrade (unattended mode)
echo "→ Running upgrade..."
echo ""
echo "The installer will automatically:"
echo " • Detect existing installation"
echo " • Upgrade to latest version"
echo " • Preserve configuration"
echo " • Keep registration"
echo ""
sleep 2
echo -e "${DIM}──────────────────────────────────────────────────────────────${NC}"
# Run installer in unattended mode
./Cyber_Protection_Agent_for_Linux_x86_64.bin -a
UPGRADE_EXIT_CODE=$?
echo -e "${DIM}──────────────────────────────────────────────────────────────${NC}"
echo ""
# Check result
if [ $UPGRADE_EXIT_CODE -eq 0 ]; then
print_success "Upgrade completed successfully!"
echo ""
# Check new version
echo "→ Verifying upgrade..."
sleep 2
if [ -f "/usr/lib/Acronis/BackupAndRecovery/aakore" ]; then
new_version=$(/usr/lib/Acronis/BackupAndRecovery/aakore --version 2>/dev/null | head -1 || echo "Unknown")
echo " New version: ${new_version}"
echo ""
if [ "$new_version" != "$current_version" ]; then
print_success "Agent upgraded: $current_version$new_version"
else
echo " ${YELLOW}Version appears unchanged (may already be latest)${NC}"
fi
fi
echo ""
# Check services
echo "→ Checking services..."
sleep 1
if systemctl is-active --quiet acronis_mms; then
print_success "Services are running"
else
echo " ${YELLOW}⚠ Services may need restart${NC}"
echo ""
echo -n "Restart Acronis services? (yes/no): "
read -r restart_confirm
if [[ "$restart_confirm" =~ ^[Yy]([Ee][Ss])?$ ]]; then
echo ""
echo "→ Restarting services..."
systemctl restart aakore
systemctl restart acronis_mms
systemctl restart acronis_schedule
sleep 2
if systemctl is-active --quiet acronis_mms; then
print_success "Services restarted"
else
print_error "Service restart failed"
echo "Check status: systemctl status acronis_mms"
fi
fi
fi
echo ""
echo -e "${GREEN}${BOLD}✓ Upgrade Complete${NC}"
echo ""
echo "The agent has been upgraded and remains registered."
echo "Backups will continue according to existing schedules."
echo ""
else
print_error "Upgrade failed with exit code $UPGRADE_EXIT_CODE"
echo ""
echo "Common issues:"
echo " • Agent is already latest version"
echo " • Insufficient disk space"
echo " • Services in use"
echo ""
echo "Check logs for details:"
echo " tail -f /var/lib/Acronis/BackupAndRecovery/MMS/mms.0.log"
echo ""
fi
# Cleanup
echo "→ Cleaning up installation files..."
cd "$SCRIPT_DIR"
rm -rf "$INSTALL_DIR"
echo ""
press_enter
;;
*)
echo ""
echo "Update cancelled"
press_enter
;;
esac