OVHserver/opt/infrastructure-docs/scripts/modules/generate-services.sh
SamoilenkoVadym a987d45fbc chore: initial infrastructure setup with Syncthing, Git and documentation
Set up three-tier synchronization: Syncthing (real-time), GitHub (version control), rsync (disaster recovery). Includes complete documentation for future Claude sessions.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 16:41:12 +00:00

58 lines
1.3 KiB
Bash
Executable file
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Module 3: All Services
cat << 'EOF'
---
## 3⃣ ALL SERVICES
### Docker Containers Overview
EOF
RUNNING=$(docker ps -q | wc -l)
STOPPED=$(docker ps -aq -f status=exited | wc -l)
PAUSED=$(docker ps -aq -f status=paused | wc -l)
echo "- **Running:** $RUNNING containers"
echo "- **Stopped:** $STOPPED containers"
echo "- **Paused:** $PAUSED containers"
echo ""
echo "### Running Containers"
echo ""
docker ps --format '{{.Names}}|{{.Status}}|{{.Image}}' | sort | while IFS='|' read -r name status image; do
if echo "$status" | grep -q "unhealthy"; then
EMOJI="🔴"
elif echo "$status" | grep -q "healthy"; then
EMOJI="🟢"
else
EMOJI="🟡"
fi
RESTARTS=$(docker inspect --format='{{.RestartCount}}' "$name" 2>/dev/null || echo "0")
CREATED=$(docker inspect --format='{{.Created}}' "$name" 2>/dev/null | cut -d'T' -f1)
cat << SERVICE
#### $EMOJI **$name**
- **Status:** $status
- **Image:** \`$image\`
- **Restarts:** $RESTARTS
- **Created:** $CREATED
- **View logs:** \`docker logs -f --tail 100 $name\`
- **Restart:** \`docker restart $name\`
- **Stop:** \`docker stop $name\`
SERVICE
done
if [[ "$STOPPED" -gt 0 ]]; then
cat << EOF
### ⚫ Stopped Containers
EOF
docker ps -a -f status=exited --format '- **{{.Names}}** - Stopped {{.Status}}'
fi