#!/bin/bash
# GuruRMM Agent Installer for Scileppi Law Firm
# Usage: curl -fsSL https://rmm.azcomputerguru.com/install/scileppi | sudo bash
set -e
SITE_ID="9571d9ff-2a43-40b8-9691-63ded40c85b8"
ARCH=$(uname -m)
echo "Installing GuruRMM Agent for Scileppi Law Firm..."
echo "Architecture: $ARCH"
# Determine download URL based on architecture
if [ "$ARCH" = "arm64" ]; then
DOWNLOAD_URL="https://rmm.azcomputerguru.com/downloads/gururmm-agent-macos-arm64-latest"
elif [ "$ARCH" = "x86_64" ]; then
DOWNLOAD_URL="https://rmm.azcomputerguru.com/downloads/gururmm-agent-macos-amd64-latest"
else
echo "Error: Unsupported architecture: $ARCH"
exit 1
fi
# Download agent
echo "Downloading agent..."
curl -fsSL -o /usr/local/bin/gururmm-agent "$DOWNLOAD_URL"
chmod 755 /usr/local/bin/gururmm-agent
# Create config.toml (required by agent)
echo "Creating configuration..."
mkdir -p /etc/gururmm
cat > /etc/gururmm/config.toml <<'CONFIG'
[server]
url = "wss://rmm-api.azcomputerguru.com/ws"
api_key = "will-auto-enroll"
[metrics]
interval_seconds = 60
collect_cpu = true
collect_memory = true
collect_disk = true
collect_network = true
CONFIG
# Create site.plist for site_id
mkdir -p /usr/local/etc/gururmm
cat > /usr/local/etc/gururmm/site.plist <<'PLIST'
SiteId
9571d9ff-2a43-40b8-9691-63ded40c85b8
PLIST
# Create LaunchDaemon
echo "Installing service..."
cat > /Library/LaunchDaemons/com.azcomputerguru.gururmm-agent.plist <<'LAUNCHD'
Label
com.azcomputerguru.gururmm-agent
ProgramArguments
/usr/local/bin/gururmm-agent
run
RunAtLoad
KeepAlive
StandardOutPath
/Library/Logs/GuruRMM/stdout.log
StandardErrorPath
/Library/Logs/GuruRMM/stderr.log
LAUNCHD
# Create log directory
mkdir -p /Library/Logs/GuruRMM
# Stop existing service if running
if launchctl list 2>/dev/null | grep -q com.azcomputerguru.gururmm-agent; then
echo "Stopping existing service..."
launchctl unload /Library/LaunchDaemons/com.azcomputerguru.gururmm-agent.plist 2>/dev/null || true
sleep 2
fi
# Load and start service
echo "Starting service..."
launchctl load /Library/LaunchDaemons/com.azcomputerguru.gururmm-agent.plist
launchctl start com.azcomputerguru.gururmm-agent
sleep 3
# Verify installation
if launchctl list | grep -q com.azcomputerguru.gururmm-agent; then
echo ""
echo "✓ GuruRMM Agent installed successfully for Scileppi Law Firm!"
echo ""
echo "The agent is now running and will appear in the dashboard shortly."
echo ""
echo "Check status: sudo launchctl list | grep gururmm"
echo "View logs: sudo tail -f /Library/Logs/GuruRMM/agent.log.*"
else
echo ""
echo "Warning: Service may not have started properly."
echo "Check logs: sudo tail -f /Library/Logs/GuruRMM/agent.log.*"
exit 1
fi