mnemo_cards/mnemo_cards_backend/restart_dev.sh
2025-11-16 14:25:27 +03:00

41 lines
1.3 KiB
Bash
Executable file
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Скрипт для перезапуска backend с обновлением generated кода
echo "🔄 Restarting Mnemo Cards Backend..."
echo ""
# Останавливаем старый процесс
echo "1⃣ Stopping old backend process..."
OLD_PID=$(lsof -ti:8000)
if [ ! -z "$OLD_PID" ]; then
echo " Killing process $OLD_PID on port 8000"
kill -9 $OLD_PID
sleep 1
echo " ✅ Process stopped"
else
echo " No process running on port 8000"
fi
echo ""
# Регенерируем код (опционально, если были изменения в @Route)
echo "2⃣ Regenerating code (if needed)..."
echo " Running: dart run build_runner build --delete-conflicting-outputs"
dart run build_runner build --delete-conflicting-outputs &> /dev/null
if [ $? -eq 0 ]; then
echo " ✅ Code regenerated successfully"
else
echo " ⚠️ Build runner failed or no changes needed"
fi
echo ""
# Запускаем backend
echo "3⃣ Starting backend..."
echo " Backend will run in HTTP mode (without SSL)"
echo " Backend will be available at http://localhost:8000"
echo ""
echo "────────────────────────────────────────────────────────"
echo ""
./run_dev.sh