- Add database migration 006 for agent_key, agent_installed, agent_install_path, agent_last_seen_at columns - Add Server model methods: findByAgentKey, generateAgentKey, regenerateAgentKey, updateAgentLastSeen, setAgentInstalled - Auto-generate agent_key on server creation - Create AgentService for SSH-based install/uninstall of remote agent - Create bin/agent.sh - bash agent script for remote servers - Create install/agent-install.sh and install/agent-uninstall.sh - Create install/servermanager-agent.service systemd unit - Add POST /api/metrics/push endpoint (auth via agent_key) - Add web routes for agent install/uninstall/regenerate-key - Add agent status section to server detail view with install/uninstall modals - Make MonitoringService::saveMetrics() public for reuse
23 lines
588 B
Bash
23 lines
588 B
Bash
#!/bin/bash
|
|
# ServerManager Agent Uninstaller
|
|
set -e
|
|
|
|
AGENT_BIN="/usr/local/bin/servermanager-agent"
|
|
CONFIG_DIR="/etc/servermanager"
|
|
SERVICE_FILE="/etc/systemd/system/servermanager-agent.service"
|
|
|
|
echo "[1/3] Stopping and disabling service..."
|
|
systemctl stop servermanager-agent 2>/dev/null || true
|
|
systemctl disable servermanager-agent 2>/dev/null || true
|
|
systemctl daemon-reload
|
|
|
|
echo "[2/3] Removing files..."
|
|
rm -f "$AGENT_BIN"
|
|
rm -rf "$CONFIG_DIR"
|
|
rm -f "$SERVICE_FILE"
|
|
|
|
echo "[3/3] Reloading systemd..."
|
|
systemctl daemon-reload
|
|
|
|
echo "ServerManager Agent uninstalled successfully."
|