ProxmoxBackupClientPBSClien.../docker/scripts/healthcheck.sh
zaphod-black fbe81d28ae Add Docker-based cross-platform solution (v1.2.0)
Major addition: Full Docker implementation for Windows, macOS, and Linux support

New Features:
- Docker container with PBS client in Debian environment
- Platform-specific docker-compose files (linux/windows/macos)
- Daemon mode with internal cron scheduler
- One-shot backup mode for manual execution
- Optional REST API server for remote management
- Health monitoring and status endpoints
- Automatic encryption key generation and management

Docker Structure:
- docker/Dockerfile - Container build definition
- docker/scripts/ - Entrypoint, backup, healthcheck, and API scripts
- docker/build.sh - Build script for Docker image
- docker/deploy.sh - Interactive deployment script
- docker/docker-compose-*.yml - Platform-specific configurations

Documentation:
- docker/README-DOCKER.md - Complete Docker documentation
- docker/QUICKSTART-DOCKER.md - Quick start guide
- docker/DOCKER-SOLUTION-SUMMARY.md - Architecture overview
- BACKUP-TYPES-GUIDE.md - File vs block device backup guide

Updated:
- README.md - Added cross-platform support section and platform matrix
- CHANGELOG.md - Documented all Docker features

This enables PBSClientTool to backup Windows and Mac systems via Docker,
while maintaining native Linux performance for full disk images.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 22:36:41 -06:00

44 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
# Healthcheck script for Docker container
# Check if cron is running (daemon mode)
if [ "$MODE" = "daemon" ]; then
if ! pgrep -x "cron" > /dev/null; then
echo "Cron is not running"
exit 1
fi
fi
# Check if last backup was successful (if any backups have run)
if [ -f /logs/status.json ]; then
SUCCESS=$(jq -r '.success' /logs/status.json 2>/dev/null || echo "null")
if [ "$SUCCESS" = "false" ]; then
echo "Last backup failed"
exit 1
fi
# Check if backup is too old (more than 48 hours)
LAST_BACKUP=$(jq -r '.last_backup' /logs/status.json 2>/dev/null || echo "")
if [ -n "$LAST_BACKUP" ]; then
LAST_TIMESTAMP=$(date -d "$LAST_BACKUP" +%s 2>/dev/null || echo "0")
CURRENT_TIMESTAMP=$(date +%s)
AGE=$((CURRENT_TIMESTAMP - LAST_TIMESTAMP))
# 48 hours = 172800 seconds
if [ $AGE -gt 172800 ]; then
echo "Last backup is too old (>48 hours)"
exit 1
fi
fi
fi
# Check if PBS connection is working (quick test)
export PBS_REPOSITORY
export PBS_PASSWORD
if ! timeout 5 proxmox-backup-client snapshot list >/dev/null 2>&1; then
echo "Cannot connect to PBS server"
exit 1
fi
echo "Healthy"
exit 0