8fbfc73991
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>
279 lines
8.4 KiB
Bash
Executable File
279 lines
8.4 KiB
Bash
Executable File
#!/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 "/etc/Acronis/Global.config" ]; then
|
|
if grep -q "CloudUrl" "/etc/Acronis/Global.config" 2>/dev/null; then
|
|
echo -e " ${GREEN}✓${NC} Agent is registered with Acronis Cloud"
|
|
|
|
# Extract cloud URL if possible
|
|
cloud_url=$(grep -oP 'CloudUrl[>="].*?https://[^"<]+' /etc/Acronis/Global.config 2>/dev/null | grep -oP 'https://[^"<]+' | head -1)
|
|
if [ -n "$cloud_url" ]; then
|
|
echo -e " URL: ${cloud_url}"
|
|
fi
|
|
else
|
|
echo -e " ${YELLOW}⚠${NC} Agent may not be registered"
|
|
fi
|
|
else
|
|
echo -e " ${YELLOW}⚠${NC} Configuration file not found"
|
|
fi
|
|
|
|
echo ""
|
|
|
|
# Check active ports
|
|
echo -e "${BOLD}Network Connectivity:${NC}"
|
|
echo -e "Active Acronis ports:"
|
|
|
|
declare -a PORTS=(
|
|
"80:HTTP"
|
|
"443:HTTPS/Cloud"
|
|
"5060:Agent Management"
|
|
"7770:Backup Traffic"
|
|
"7800:Backup Gateway"
|
|
"8443:Web Console"
|
|
"44445:Agent Communication"
|
|
)
|
|
|
|
ports_found=false
|
|
for port_entry in "${PORTS[@]}"; do
|
|
IFS=':' read -r port port_desc <<< "$port_entry"
|
|
if netstat -tuln 2>/dev/null | grep -q ":${port}\s"; then
|
|
echo -e " ${GREEN}✓${NC} Port ${port} (${port_desc})"
|
|
ports_found=true
|
|
fi
|
|
done
|
|
|
|
if [ "$ports_found" = false ]; then
|
|
echo -e " ${DIM}No Acronis ports currently listening${NC}"
|
|
fi
|
|
|
|
echo ""
|
|
|
|
# Check disk space for backups
|
|
echo -e "${BOLD}Storage Status:${NC}"
|
|
if [ -d "/var/lib/Acronis" ]; then
|
|
local backup_dir_size=$(du -sh /var/lib/Acronis 2>/dev/null | awk '{print $1}')
|
|
echo -e " Acronis data: ${backup_dir_size}"
|
|
|
|
# Check free space
|
|
local free_space=$(df -h /var/lib/Acronis | tail -1 | awk '{print $4}')
|
|
local use_percent=$(df -h /var/lib/Acronis | tail -1 | awk '{print $5}' | tr -d '%')
|
|
|
|
echo -e " Free space: ${free_space}"
|
|
|
|
if [ "$use_percent" -gt 90 ]; then
|
|
echo -e " ${RED}⚠ Warning: Disk usage at ${use_percent}%${NC}"
|
|
fi
|
|
fi
|
|
|
|
echo ""
|
|
|
|
# Quick Actions
|
|
echo -e "${BOLD}Quick Actions:${NC}"
|
|
echo ""
|
|
echo -e " ${CYAN}1)${NC} Start All Services"
|
|
echo -e " ${CYAN}2)${NC} Stop All Services"
|
|
echo -e " ${CYAN}3)${NC} Restart All Services"
|
|
echo -e " ${CYAN}4)${NC} View Live Logs"
|
|
echo -e " ${CYAN}5)${NC} Check Agent Version"
|
|
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)
|
|
echo ""
|
|
echo "Starting all Acronis services..."
|
|
systemctl start aakore
|
|
systemctl start acronis_mms
|
|
systemctl start acronis_schedule
|
|
systemctl start active-protection
|
|
echo ""
|
|
print_success "Services started"
|
|
sleep 2
|
|
exec "$0"
|
|
;;
|
|
2)
|
|
echo ""
|
|
echo "Stopping all Acronis services..."
|
|
systemctl stop active-protection
|
|
systemctl stop acronis_schedule
|
|
systemctl stop acronis_mms
|
|
systemctl stop aakore
|
|
echo ""
|
|
print_success "Services stopped"
|
|
sleep 2
|
|
exec "$0"
|
|
;;
|
|
3)
|
|
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"
|
|
sleep 2
|
|
exec "$0"
|
|
;;
|
|
4)
|
|
if [ -f "/var/lib/Acronis/BackupAndRecovery/MMS/mms.0.log" ]; then
|
|
echo ""
|
|
echo "Showing live log (Ctrl+C to exit)..."
|
|
sleep 1
|
|
tail -f /var/lib/Acronis/BackupAndRecovery/MMS/mms.0.log
|
|
else
|
|
print_error "Log file not found"
|
|
press_enter
|
|
fi
|
|
;;
|
|
5)
|
|
echo ""
|
|
echo -e "${BOLD}Agent Version Information:${NC}"
|
|
if command -v /usr/lib/Acronis/BackupAndRecovery/aakore &>/dev/null; then
|
|
/usr/lib/Acronis/BackupAndRecovery/aakore --version 2>/dev/null || echo "Version info not available"
|
|
else
|
|
echo "Agent binary not found"
|
|
fi
|
|
echo ""
|
|
press_enter
|
|
;;
|
|
*)
|
|
# Return to menu
|
|
exit 0
|
|
;;
|
|
esac
|