Files
usda-vision/camera-management-api/start_system.sh
salirezav 98c93f9e0e Change video storage directory from /storage to /mnt/nfs_share
- Update StorageConfig default base_path in core/config.py
- Update base_path and camera storage_paths in config.json and config.compose.json
- Update Docker Compose volume mounts to use /mnt/nfs_share
- Update start_system.sh to create /mnt/nfs_share directory
- Update convert_avi_to_mp4.sh to use new NFS path
- Update all documentation files to reflect new storage paths
- Videos now stored on NFS server at 192.168.1.249:/mnt/nfs_share/
2025-10-14 16:28:00 -04:00

76 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# USDA Vision Camera System Startup Script
echo "USDA Vision Camera System - Startup Script"
echo "=========================================="
# Ensure we are running from the script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
echo "📂 Working directory: $SCRIPT_DIR"
# Check if virtual environment exists
if [ ! -d ".venv" ]; then
echo "❌ Virtual environment not found. Please run 'uv sync' first."
exit 1
fi
# Activate virtual environment
echo "🔧 Activating virtual environment..."
source .venv/bin/activate
# Ensure project root is on PYTHONPATH for imports
export PYTHONPATH="$SCRIPT_DIR:$PYTHONPATH"
# Check if config file exists
if [ ! -f "config.json" ]; then
echo "⚠️ Config file not found. Using default configuration."
fi
# Check storage directory
if [ ! -d "/mnt/nfs_share" ]; then
echo "📁 Creating storage directory..."
sudo mkdir -p /mnt/nfs_share
sudo chown $USER:$USER /mnt/nfs_share
echo "✅ Storage directory created at /mnt/nfs_share"
fi
# Check time synchronization
echo "🕐 Checking time synchronization..."
python tests/core/check_time.py
echo ""
# Run system tests first
echo "🧪 Running system tests..."
python tests/integration/test_system.py
if [ $? -ne 0 ]; then
echo "❌ System tests failed. Please check the configuration."
# When running as a service, don't prompt for user input
if [ -t 0 ]; then
# Interactive mode - prompt user
read -p "Do you want to continue anyway? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
else
# Non-interactive mode (service) - continue with warning
echo "⚠️ Running in non-interactive mode. Continuing despite test failures..."
sleep 2
fi
fi
echo ""
echo "🚀 Starting USDA Vision Camera System..."
echo " - MQTT monitoring will begin automatically"
echo " - Camera recording will start when machines turn on"
echo " - API server will be available at http://localhost:8000"
echo " - Press Ctrl+C to stop the system"
echo ""
# Start the system
python main.py "$@"
echo "👋 USDA Vision Camera System stopped."