install-service.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. # Installation script for Gogs MCP Server systemd service
  3. set -e
  4. echo "Installing Gogs MCP Server systemd service..."
  5. # Check if running as root
  6. if [ "$EUID" -ne 0 ]; then
  7. echo "This script must be run as root (use sudo)"
  8. exit 1
  9. fi
  10. # Get the directory where this script is located
  11. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  12. # Copy service file to systemd directory
  13. echo "Copying service file to /etc/systemd/system/..."
  14. cp "$SCRIPT_DIR/gogs-mcp-server.service" /etc/systemd/system/
  15. # Reload systemd daemon
  16. echo "Reloading systemd daemon..."
  17. systemctl daemon-reload
  18. # Enable the service to start on boot
  19. echo "Enabling service to start on boot..."
  20. systemctl enable gogs-mcp-server
  21. echo ""
  22. echo "Installation complete!"
  23. echo ""
  24. echo "Before starting the service, please edit the configuration:"
  25. echo " sudo nano /etc/systemd/system/gogs-mcp-server.service"
  26. echo ""
  27. echo "Update these environment variables:"
  28. echo " - GOGS_SERVER_URL (your Gogs server URL)"
  29. echo " - GOGS_ACCESS_TOKEN (your Gogs access token)"
  30. echo ""
  31. echo "Then reload and start the service:"
  32. echo " sudo systemctl daemon-reload"
  33. echo " sudo systemctl start gogs-mcp-server"
  34. echo " sudo systemctl status gogs-mcp-server"
  35. echo ""
  36. echo "View logs with:"
  37. echo " sudo journalctl -u gogs-mcp-server -f"
  38. echo ""