#!/bin/bash # Install StreamFlow Update Server as a systemd service SERVICE_NAME="streamflow-update-server" SERVICE_FILE="$SERVICE_NAME.service" SYSTEMD_DIR="$HOME/.config/systemd/user" echo "🚀 Installing StreamFlow Update Server Service" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" # Create systemd user directory if it doesn't exist mkdir -p "$SYSTEMD_DIR" # Copy service file echo "📁 Copying service file to $SYSTEMD_DIR" cp "$SERVICE_FILE" "$SYSTEMD_DIR/" # Reload systemd daemon echo "🔄 Reloading systemd daemon" systemctl --user daemon-reload # Enable service to start on boot echo "✅ Enabling service to start on boot" systemctl --user enable "$SERVICE_NAME" # Start the service echo "▶️ Starting service" systemctl --user start "$SERVICE_NAME" # Check status echo "" echo "📊 Service Status:" systemctl --user status "$SERVICE_NAME" --no-pager echo "" echo "✅ Installation complete!" echo "" echo "Useful commands:" echo " systemctl --user status $SERVICE_NAME # Check status" echo " systemctl --user stop $SERVICE_NAME # Stop service" echo " systemctl --user start $SERVICE_NAME # Start service" echo " systemctl --user restart $SERVICE_NAME # Restart service" echo " systemctl --user disable $SERVICE_NAME # Disable autostart" echo " journalctl --user -u $SERVICE_NAME -f # View logs" echo "" echo "🌐 Update server running at: http://localhost:9000"