Torrent-Manager/test-installation.sh
MasterDraco 573031fcc9 fix: Ensure app runs as framework-dependent with proper runtimeconfig.json
- Added correct runtimeconfig.json for Microsoft.AspNetCore.OpenApi reference
- Fixed systemd service to specify correct working directory and environment
- Set explicit --no-self-contained and framework target for publishing
- Added test-installation.sh script for easy verification
- Fixed libhostpolicy.so error when running as a service

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-12 22:20:42 +00:00

114 lines
3.9 KiB
Bash
Executable File

#!/bin/bash
# Transmission RSS Manager Test Script
# This script checks if the Transmission RSS Manager is installed and running correctly
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${GREEN}Transmission RSS Manager Test Script${NC}"
echo -e "${YELLOW}This script will check if your installation is working correctly${NC}"
echo
# Check if service is installed
if [ ! -f "/etc/systemd/system/transmission-rss-manager.service" ]; then
echo -e "${RED}ERROR: Service file not found. Installation seems incomplete.${NC}"
exit 1
fi
echo -e "${GREEN}${NC} Service file found"
# Check if service is running
if systemctl is-active --quiet transmission-rss-manager; then
echo -e "${GREEN}${NC} Service is running"
else
echo -e "${YELLOW}⚠ Service is not running. Attempting to start...${NC}"
sudo systemctl start transmission-rss-manager
sleep 2
if systemctl is-active --quiet transmission-rss-manager; then
echo -e "${GREEN}${NC} Service successfully started"
else
echo -e "${RED}ERROR: Failed to start service. Checking logs...${NC}"
echo
echo -e "${YELLOW}Service Logs:${NC}"
sudo journalctl -u transmission-rss-manager -n 20 --no-pager
exit 1
fi
fi
# Check application files
INSTALL_DIR="/opt/transmission-rss-manager"
PUBLISH_DIR="$INSTALL_DIR/publish"
if [ ! -d "$PUBLISH_DIR" ]; then
echo -e "${RED}ERROR: Application directory not found at $PUBLISH_DIR${NC}"
exit 1
fi
echo -e "${GREEN}${NC} Application directory found"
# Check for main DLL
APP_DLL=$(find $INSTALL_DIR/publish -name "TransmissionRssManager.dll" 2>/dev/null)
if [ -z "$APP_DLL" ]; then
echo -e "${RED}ERROR: Main application DLL not found${NC}"
exit 1
fi
echo -e "${GREEN}${NC} Application files found"
# Check for config file
CONFIG_DIR="/etc/transmission-rss-manager"
if [ ! -f "$CONFIG_DIR/appsettings.json" ]; then
echo -e "${RED}ERROR: Configuration file not found at $CONFIG_DIR/appsettings.json${NC}"
exit 1
fi
echo -e "${GREEN}${NC} Configuration file found"
# Check for runtime config file
APP_NAME=$(basename "$APP_DLL" .dll)
if [ ! -f "$PUBLISH_DIR/$APP_NAME.runtimeconfig.json" ]; then
echo -e "${RED}ERROR: Runtime configuration file not found${NC}"
exit 1
fi
echo -e "${GREEN}${NC} Runtime configuration file found"
# Check web service response
echo -e "${YELLOW}Checking web service (this may take a few seconds)...${NC}"
for i in {1..15}; do
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5000 2>/dev/null || echo "000")
if [ "$HTTP_STATUS" = "200" ] || [ "$HTTP_STATUS" = "302" ]; then
echo -e "${GREEN}${NC} Web service is responsive (HTTP $HTTP_STATUS)"
WEB_OK=true
break
fi
sleep 1
done
if [ -z "$WEB_OK" ]; then
echo -e "${RED}⚠ Web service is not responding. This might be normal if your app doesn't serve content on the root path.${NC}"
echo -e "${YELLOW}Trying to check API/health endpoint instead...${NC}"
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5000/api/config 2>/dev/null || echo "000")
if [ "$HTTP_STATUS" = "200" ] || [ "$HTTP_STATUS" = "302" ] || [ "$HTTP_STATUS" = "401" ] || [ "$HTTP_STATUS" = "404" ]; then
echo -e "${GREEN}${NC} API endpoint is responsive (HTTP $HTTP_STATUS)"
else
echo -e "${RED}ERROR: Web service does not appear to be working (HTTP $HTTP_STATUS).${NC}"
echo -e "${YELLOW}Checking service logs:${NC}"
sudo journalctl -u transmission-rss-manager -n 20 --no-pager
exit 1
fi
fi
# Installation successful
echo
echo -e "${GREEN}✅ Transmission RSS Manager appears to be installed and running correctly!${NC}"
echo -e "${YELLOW}Web interface: http://localhost:5000${NC}"
echo -e "${YELLOW}Configuration: $CONFIG_DIR/appsettings.json${NC}"
echo
echo -e "To view logs: ${YELLOW}sudo journalctl -u transmission-rss-manager -f${NC}"
echo -e "To restart: ${YELLOW}sudo systemctl restart transmission-rss-manager${NC}"