#!/bin/bash # Stella's Orly Relay Management Script set -e RELAY_SERVICE="stella-relay" RELAY_URL="ws://127.0.0.1:7777" case "${1:-}" in "start") echo "๐Ÿš€ Starting Stella's Orly Relay..." sudo systemctl start $RELAY_SERVICE echo "โœ… Relay started!" ;; "stop") echo "โน๏ธ Stopping Stella's Orly Relay..." sudo systemctl stop $RELAY_SERVICE echo "โœ… Relay stopped!" ;; "restart") echo "๐Ÿ”„ Restarting Stella's Orly Relay..." sudo systemctl restart $RELAY_SERVICE echo "โœ… Relay restarted!" ;; "status") echo "๐Ÿ“Š Stella's Orly Relay Status:" sudo systemctl status $RELAY_SERVICE --no-pager ;; "logs") echo "๐Ÿ“œ Stella's Orly Relay Logs:" sudo journalctl -u $RELAY_SERVICE -f --no-pager ;; "test") echo "๐Ÿงช Testing relay connection..." if curl -s -I http://127.0.0.1:7777 | grep -q "426 Upgrade Required"; then echo "โœ… Relay is responding correctly!" echo "๐Ÿ“ก WebSocket URL: $RELAY_URL" else echo "โŒ Relay is not responding correctly" exit 1 fi ;; "enable") echo "๐Ÿ”ง Enabling relay to start at boot..." sudo systemctl enable $RELAY_SERVICE echo "โœ… Relay will start automatically at boot!" ;; "disable") echo "๐Ÿ”ง Disabling relay auto-start..." sudo systemctl disable $RELAY_SERVICE echo "โœ… Relay will not start automatically at boot!" ;; "info") echo "๐Ÿ“‹ Stella's Orly Relay Information:" echo " Service: $RELAY_SERVICE" echo " WebSocket URL: $RELAY_URL" echo " HTTP URL: http://127.0.0.1:7777" echo " Data Directory: /home/madmin/.local/share/orly-relay" echo " Config Directory: $(pwd)" echo "" echo "๐Ÿ”‘ Admin NPubs:" echo " Stella: npub1v30tsz9vw6ylpz63g0a702nj3xa26t3m7p5us8f2y2sd8v6cnsvq465zjx" echo " Admin2: npub1l5sga6xg72phsz5422ykujprejwud075ggrr3z2hwyrfgr7eylqstegx9z" ;; *) echo "๐ŸŒฒ Stella's Orly Relay Management Script" echo "" echo "Usage: $0 [COMMAND]" echo "" echo "Commands:" echo " start Start the relay" echo " stop Stop the relay" echo " restart Restart the relay" echo " status Show relay status" echo " logs Show relay logs (follow mode)" echo " test Test relay connection" echo " enable Enable auto-start at boot" echo " disable Disable auto-start at boot" echo " info Show relay information" echo "" echo "Examples:" echo " $0 start # Start the relay" echo " $0 status # Check if it's running" echo " $0 test # Test WebSocket connection" echo " $0 logs # Watch real-time logs" echo "" echo "๐ŸŒฒ Crafted in the digital forest by Stella โœจ" ;; esac