feat: add comprehensive management scripts for CodiMD

Add 9 management scripts to simplify CodiMD operations:
- start.sh: Start services with automatic .env setup
- stop.sh: Stop all services gracefully
- restart.sh: Restart all services
- logs.sh: View real-time logs for any service
- status.sh: Check service status and resource usage
- backup.sh: Backup database, uploads, and environment
- restore.sh: Restore from backups with interactive selection
- update.sh: Update Docker images with automatic backup
- cleanup.sh: Clean unused Docker resources

Add SCRIPTS.md with comprehensive usage documentation and examples.

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 17:41:10 +08:00
parent cbe76b1f96
commit 9ea9eb4b61
10 changed files with 548 additions and 0 deletions

33
status.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
# CodiMD 狀態檢查腳本
echo "🔍 檢查 CodiMD 服務狀態..."
echo ""
# 顯示容器狀態
echo "📊 Docker 容器狀態:"
docker-compose ps
echo ""
# 檢查服務是否正常
if docker-compose ps | grep -q "Up (healthy)"; then
echo "✅ 所有服務運行正常"
else
echo "⚠️ 部分服務可能未正常運行"
fi
echo ""
# 顯示最近日誌
echo "📋 最近日誌(最後 20 行):"
docker-compose logs --tail=20
echo ""
# 檢查磁碟空間
echo "💾 磁碟空間:"
df -h | grep -E "Filesystem|/$"
echo ""
# 檢查 Docker 資源使用
echo "📊 Docker 資源使用:"
docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}" 2>/dev/null || echo "無法取得資源使用資訊"