Files
chat/stop_all_services.sh
Andrew K. Choi 91c7e04474
All checks were successful
continuous-integration/drone/push Build is passing
API refactor
2025-10-07 16:25:52 +09:00

39 lines
1.2 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

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
# Скрипт для остановки всех микросервисов Women Safety App
# Цвета для вывода
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
RED="\033[0;31m"
NC="\033[0m" # No Color
# Проверка, запущены ли сервисы
services=("user_service" "emergency_service" "location_service" "calendar_service" "notification_service")
for service in "${services[@]}"; do
pid_file="/tmp/${service}.pid"
if [ -f "$pid_file" ]; then
pid=$(cat "$pid_file")
if ps -p "$pid" > /dev/null; then
echo -e "${YELLOW}Остановка ${service}...${NC}"
kill "$pid"
rm "$pid_file"
else
echo -e "${YELLOW}Сервис ${service} не запущен или PID не найден${NC}"
rm "$pid_file"
fi
else
echo -e "${YELLOW}PID файл для ${service} не найден${NC}"
fi
done
# Остановка API Gateway
gateway_pid=$(lsof -t -i:8000 2>/dev/null)
if [ -n "$gateway_pid" ]; then
echo -e "${YELLOW}Остановка API Gateway...${NC}"
kill "$gateway_pid"
fi
echo -e "${GREEN}Все сервисы остановлены${NC}"