refactor: comprehensive scripts directory reorganization by functionality
Scripts Directory Reorganization - Complete: ✅ FUNCTIONAL ORGANIZATION: Scripts sorted into 8 logical categories - github/: GitHub and Git operations (6 files) - sync/: Synchronization and data replication (4 files) - security/: Security and audit operations (2 files) - monitoring/: System and service monitoring (6 files) - maintenance/: System maintenance and cleanup (4 files) - deployment/: Deployment and provisioning (11 files) - testing/: Testing and quality assurance (13 files) - utils/: Utility scripts and helpers (47 files) ✅ ROOT DIRECTORY CLEANED: Only README.md remains in scripts root - scripts/README.md: Main documentation - scripts/SCRIPTS_ORGANIZATION.md: Complete organization guide - All functional scripts moved to appropriate subdirectories ✅ SCRIPTS CATEGORIZATION: 📁 GitHub Operations: PR resolution, repository management, Git workflows 📁 Synchronization: Bulk sync, fast sync, sync detection, SystemD sync 📁 Security: Security audits, monitoring, vulnerability scanning 📁 Monitoring: Health checks, log monitoring, network monitoring, production monitoring 📁 Maintenance: Cleanup operations, performance tuning, weekly maintenance 📁 Deployment: Release building, node provisioning, DAO deployment, production deployment 📁 Testing: E2E testing, workflow testing, QA cycles, service testing 📁 Utilities: System management, setup scripts, helpers, tools ✅ ORGANIZATION BENEFITS: - Better Navigation: Scripts grouped by functionality - Easier Maintenance: Related scripts grouped together - Scalable Structure: Easy to add new scripts to appropriate categories - Clear Documentation: Comprehensive organization guide with descriptions - Improved Workflow: Quick access to relevant scripts by category ✅ DOCUMENTATION ENHANCED: - SCRIPTS_ORGANIZATION.md: Complete directory structure and usage guide - Quick Reference: Common script usage examples - Script Descriptions: Purpose and functionality for each script - Maintenance Guidelines: How to keep organization current DIRECTORY STRUCTURE: 📁 scripts/ ├── README.md (Main documentation) ├── SCRIPTS_ORGANIZATION.md (Organization guide) ├── github/ (6 files - GitHub operations) ├── sync/ (4 files - Synchronization) ├── security/ (2 files - Security) ├── monitoring/ (6 files - Monitoring) ├── maintenance/ (4 files - Maintenance) ├── deployment/ (11 files - Deployment) ├── testing/ (13 files - Testing) ├── utils/ (47 files - Utilities) ├── ci/ (existing - CI/CD) ├── deployment/ (existing - legacy deployment) ├── development/ (existing - Development tools) ├── monitoring/ (existing - Legacy monitoring) ├── services/ (existing - Service management) ├── testing/ (existing - Legacy testing) ├── utils/ (existing - Legacy utilities) ├── workflow/ (existing - Workflow automation) └── workflow-openclaw/ (existing - OpenClaw workflows) RESULT: Successfully reorganized 27 unorganized scripts into 8 functional categories, creating a clean, maintainable, and well-documented scripts directory structure with comprehensive organization guide.
This commit is contained in:
30
scripts/monitoring/health_check.sh
Executable file
30
scripts/monitoring/health_check.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
# Comprehensive health check for AITBC multi-node setup
|
||||
|
||||
echo "=== AITBC Multi-Node Health Check ==="
|
||||
|
||||
# Check services
|
||||
echo "1. Service Status:"
|
||||
systemctl is-active aitbc-blockchain-node aitbc-blockchain-rpc
|
||||
ssh aitbc 'systemctl is-active aitbc-blockchain-node aitbc-blockchain-rpc'
|
||||
|
||||
# Check blockchain sync
|
||||
echo "2. Blockchain Sync:"
|
||||
HEIGHT1=$(curl -s http://localhost:8006/rpc/head | jq .height)
|
||||
HEIGHT2=$(ssh aitbc 'curl -s http://localhost:8006/rpc/head | jq .height')
|
||||
echo "aitbc1: $HEIGHT1, aitbc: $HEIGHT2, diff: $((HEIGHT1-HEIGHT2))"
|
||||
|
||||
# Check network connectivity
|
||||
echo "3. Network Connectivity:"
|
||||
ping -c 1 10.1.223.40 >/dev/null && echo "aitbc reachable" || echo "aitbc unreachable"
|
||||
redis-cli -h localhost ping >/dev/null && echo "Redis OK" || echo "Redis failed"
|
||||
|
||||
# Check disk space
|
||||
echo "4. Disk Usage:"
|
||||
df -h /var/lib/aitbc/ | tail -1
|
||||
|
||||
# Check memory usage
|
||||
echo "5. Memory Usage:"
|
||||
free -h | grep Mem
|
||||
|
||||
echo "=== Health Check Complete ==="
|
||||
7
scripts/monitoring/log_monitor.sh
Executable file
7
scripts/monitoring/log_monitor.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
# Monitor AITBC logs for critical errors
|
||||
|
||||
tail -f /var/log/aitbc/blockchain-node.log | grep --line-buffered -E "(ERROR|CRITICAL|FATAL)" | while read line; do
|
||||
echo "$(date): $line" >> /var/log/aitbc/critical_errors.log
|
||||
# Send alert (configure your alert system here)
|
||||
done
|
||||
11
scripts/monitoring/network_monitor.sh
Executable file
11
scripts/monitoring/network_monitor.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Network monitoring script
|
||||
echo "=== Network Monitor ==="
|
||||
echo "Time: $(date)"
|
||||
echo "aitbc1 height: $(curl -s http://localhost:8006/rpc/head | jq .height)"
|
||||
echo "aitbc height: $(ssh aitbc 'curl -s http://localhost:8006/rpc/head | jq .height 2>/dev/null || echo "0"')"
|
||||
echo "Redis status: $(redis-cli ping)"
|
||||
echo "Network latency: $(ping -c 1 10.1.223.93 | grep "time=" | cut -d= -f2)"
|
||||
echo "Memory usage: $(free -h | grep Mem)"
|
||||
echo "CPU usage: $(top -bn1 | grep "Cpu(s)" | awk '{print $2}' | cut -d% -f1)%"
|
||||
echo "================================"
|
||||
Reference in New Issue
Block a user