- Linux agent v4: failed systemd services, SMART disk health, ZFS pool state, pacman updates; SMART/ZFS and self-update run in the ExecStartPre=-+ step outside the sandbox - Server: hosts' health stored (servers.host_health, migration 0029), alerts under a new "Failing services" kind plus disk/ZFS alerts, Host health card, Prometheus series - Agent self-update (Linux v4, Windows v3): admin switch on the Servers page, checksum-verified download, atomic replace; GET /api/agent/report/update - homelab_server_disk_days_to_full in /metrics - Tests (server, real PowerShell against a fake server) and docs Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
46 lines
1.5 KiB
Bash
46 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
# Removes the Homelab Manager task-reporting agent from this server: stops
|
|
# and deletes its systemd timer/service, the installed script, and its
|
|
# credentials file.
|
|
#
|
|
# Usage (must run as root — if not already root, put sudo right after the
|
|
# pipe so it applies to bash, not to curl):
|
|
# curl -fsSL https://homelab.example.lan/agent/linux/uninstall.sh | sudo bash
|
|
#
|
|
set -euo pipefail
|
|
|
|
INSTALL_DIR="/usr/local/bin"
|
|
CONFIG_DIR="/etc"
|
|
SYSTEMD_DIR="/etc/systemd/system"
|
|
|
|
if [[ "$EUID" -ne 0 ]]; then
|
|
echo "This uninstaller must be run as root." >&2
|
|
echo "If you're piping from curl, put sudo right after the pipe so it elevates bash, not curl:" >&2
|
|
echo " curl -fsSL ... | sudo bash" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Removing Homelab Manager agent..."
|
|
|
|
if command -v systemctl >/dev/null 2>&1; then
|
|
systemctl disable --now homelab-manager-agent.timer >/dev/null 2>&1 || true
|
|
fi
|
|
|
|
rm -f \
|
|
"$SYSTEMD_DIR/homelab-manager-agent.timer" \
|
|
"$SYSTEMD_DIR/homelab-manager-agent.service" \
|
|
"$CONFIG_DIR/homelab-manager-agent.env" \
|
|
"$INSTALL_DIR/homelab-manager-agent.sh" \
|
|
/tmp/hlm-agent-response.json
|
|
|
|
# What it remembered between runs (the last disk-health reading).
|
|
rm -rf /var/lib/homelab-manager-agent
|
|
|
|
if command -v systemctl >/dev/null 2>&1; then
|
|
systemctl daemon-reload
|
|
fi
|
|
|
|
echo "Done. The agent no longer runs or reports from this server."
|
|
echo "Its entry (and task history) in Homelab Manager is untouched —" \
|
|
"delete it from the Servers & Tasks page if you no longer want it tracked."
|