Files
proxmox/scripts/check-container-services.sh
defiQUG cb47cce074 Complete markdown files cleanup and organization
- Organized 252 files across project
- Root directory: 187 → 2 files (98.9% reduction)
- Moved configuration guides to docs/04-configuration/
- Moved troubleshooting guides to docs/09-troubleshooting/
- Moved quick start guides to docs/01-getting-started/
- Moved reports to reports/ directory
- Archived temporary files
- Generated comprehensive reports and documentation
- Created maintenance scripts and guides

All files organized according to established standards.
2026-01-06 01:46:25 -08:00

53 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# Check services for a single container
# Usage: ./check-container-services.sh <VMID>
VMID=$1
PROXMOX_HOST="${PROXMOX_HOST:-192.168.11.12}"
if [ -z "$VMID" ]; then
echo "Usage: $0 <VMID>"
exit 1
fi
exec_container() {
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=3 root@"$PROXMOX_HOST" "pct exec $VMID -- bash -c '$*'" 2>&1
}
echo "=== VMID $VMID ==="
CONTAINER_INFO=$(ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" "pct list | grep '^$VMID'" 2>&1)
NAME=$(echo "$CONTAINER_INFO" | awk '{print $3}')
STATUS=$(echo "$CONTAINER_INFO" | awk '{print $2}')
echo "Name: $NAME"
echo "Status: $STATUS"
if [ "$STATUS" != "running" ]; then
echo "Container not running"
exit 0
fi
# Get IP
IP=$(exec_container "hostname -I | awk '{print \$1}'" 2>&1 | head -1)
echo "IP: ${IP:-unknown}"
# Check services
echo "Services:"
SERVICES="nginx apache2 docker blockscout cloudflared postgresql mysql mariadb redis gitea firefly"
for svc in $SERVICES; do
STATUS_CHECK=$(exec_container "systemctl is-active $svc 2>/dev/null || echo 'inactive'" 2>&1)
if [ "$STATUS_CHECK" = "active" ]; then
echo "$svc: active"
fi
done
# Check Docker
DOCKER=$(exec_container "command -v docker >/dev/null 2>&1 && docker ps --format '{{.Names}}' | head -5 | tr '\n' ' ' || echo 'no'" 2>&1)
if [ "$DOCKER" != "no" ] && [ -n "$DOCKER" ]; then
echo " Docker containers: $DOCKER"
fi
# Disk usage
DISK=$(exec_container "df -h / | tail -1 | awk '{print \$5 \" (\" \$3 \"/\" \$2 \")\"}'" 2>&1)
echo "Disk usage: ${DISK:-unknown}"