Files
aitbc/dev/scripts/system/setup_systemd.sh
oib 3df0a9ed62 chore(cleanup): remove obsolete scripts and update paths for production deployment
- Remove dev/scripts/check-file-organization.sh (obsolete organization checker)
- Remove dev/scripts/community_onboarding.py (unused 559-line automation script)
- Update gpu_miner_host.py log path from /home/oib/windsurf/aitbc to /opt/aitbc
- Add service status and standardization badges to README.md
2026-03-04 13:24:38 +01:00

71 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# Setup AITBC Systemd Services
# Requirements: Python 3.11+, systemd, sudo access
echo "🔧 Setting up AITBC systemd services..."
# Validate Python version
echo "🐍 Checking Python version..."
if ! python3.11 --version >/dev/null 2>&1; then
echo "❌ Error: Python 3.11+ is required but not found"
echo " Please install Python 3.11+ and try again"
exit 1
fi
PYTHON_VERSION=$(python3.11 --version | cut -d' ' -f2)
echo "✅ Found Python $PYTHON_VERSION"
# Validate systemctl is available
if ! command -v systemctl >/dev/null 2>&1; then
echo "❌ Error: systemctl not found. This script requires systemd."
exit 1
fi
echo "✅ Systemd available"
# Copy service files
echo "📁 Copying service files..."
sudo cp systemd/aitbc-*.service /etc/systemd/system/
# Reload systemd daemon
echo "🔄 Reloading systemd daemon..."
sudo systemctl daemon-reload
# Stop existing processes
echo "⏹️ Stopping existing processes..."
pkill -f "coordinator-api" || true
pkill -f "simple_exchange_api.py" || true
pkill -f "server.py --port 3002" || true
pkill -f "wallet_daemon" || true
pkill -f "node.main" || true
# Enable services
echo "✅ Enabling services..."
sudo systemctl enable aitbc-coordinator-api.service
sudo systemctl enable aitbc-exchange-api.service
sudo systemctl enable aitbc-exchange-frontend.service
sudo systemctl enable aitbc-wallet.service
sudo systemctl enable aitbc-node.service
# Start services
echo "🚀 Starting services..."
sudo systemctl start aitbc-coordinator-api.service
sudo systemctl start aitbc-exchange-api.service
sudo systemctl start aitbc-exchange-frontend.service
sudo systemctl start aitbc-wallet.service
sudo systemctl start aitbc-node.service
# Check status
echo ""
echo "📊 Service Status:"
for service in aitbc-coordinator-api aitbc-exchange-api aitbc-exchange-frontend aitbc-wallet aitbc-node; do
status=$(sudo systemctl is-active $service)
echo " $service: $status"
done
echo ""
echo "📝 To view logs: sudo journalctl -u <service-name> -f"
echo "📝 To restart: sudo systemctl restart <service-name>"
echo "📝 To stop: sudo systemctl stop <service-name>"