#!/bin/bash # Activate Bilbo Baggins Profile # FIXED: Starts telegram bot + webhook server + churn echo "Activating Bilbo Baggins..." export HOME=/root/wizards/bilbobagginshire export HERMES_HOME=/root/wizards/bilbobagginshire/home export BILBO_MODE=active cd /root/wizards/bilbobagginshire source home/.env # Kill existing bilbo processes cleanly pkill -f bilbo_telegram || true pkill -f bilbo_churn || true pkill -f bilbo_webhook || true sleep 1 # Start Webhook server FIRST (responds to Gitea dispatches) echo "Starting Gitea webhook server (dispatches)..." nohup python3 home/bilbo_webhook_server.py > /tmp/bilbo_webhook.log 2>&1 & WEBHOOK_PID=$! echo " PID: $WEBHOOK_PID" sleep 2 # Verify webhook is listening if netstat -tlnp 2>/dev/null | grep -q ":8765"; then echo " ✓ Webhook server listening on port 8765" else echo " ⚠ Webhook server may not be listening yet" fi # Start Telegram bot (the real communication channel) echo "Starting Telegram bot (real Ollama intelligence)..." nohup python3 home/bilbo_telegram.py > /tmp/bilbo_telegram.log 2>&1 & echo " PID: $!" # Start churn (background activity) echo "Starting churn..." nohup python3 home/bilbo_churn.py > /tmp/bilbo_churn.log 2>&1 & echo " PID: $!" echo "" echo "Bilbo Status:" echo " Webhook Server: RUNNING (port 8765 - dispatches)" echo " Telegram Bot: RUNNING (real Ollama)" echo " Churn: RUNNING" echo "" echo "Bilbo is back and ready for dispatches."