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.
This commit is contained in:
Executable
+245
@@ -0,0 +1,245 @@
|
||||
#!/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 ""
|
||||
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 -n "Enter registration token: "
|
||||
read -r REGISTRATION_TOKEN
|
||||
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"
|
||||
;;
|
||||
*)
|
||||
echo ""
|
||||
echo "Mode: Interactive installation"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Ask for service URL if not using token
|
||||
if [ "$install_mode" != "4" ]; then
|
||||
echo ""
|
||||
echo -n "Acronis Cloud region [us5-cloud.acronis.com]: "
|
||||
read -r input_url
|
||||
if [ -n "$input_url" ]; then
|
||||
SERVICE_URL="$input_url"
|
||||
fi
|
||||
|
||||
if [ "$install_mode" = "3" ]; 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" != "yes" ]; then
|
||||
echo ""
|
||||
print_error "Installation cancelled"
|
||||
press_enter
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${BOLD}Starting Installation...${NC}"
|
||||
echo ""
|
||||
|
||||
# Create temp directory
|
||||
TEMP_DIR="/tmp/acronis-install-$$"
|
||||
mkdir -p "$TEMP_DIR"
|
||||
cd "$TEMP_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"
|
||||
|
||||
# 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
|
||||
./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 temporary files..."
|
||||
cd /
|
||||
rm -rf "$TEMP_DIR"
|
||||
|
||||
echo ""
|
||||
press_enter
|
||||
Reference in New Issue
Block a user