智慧水务管理系统 - 精河县供水工程综合管理平台

stop.sh 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. # Water Management System IoT Layer Stop Script
  3. set -e
  4. echo "🛑 Stopping Water Management System IoT Layer..."
  5. # Colors for output
  6. RED='\033[0;31m'
  7. GREEN='\033[0;32m'
  8. YELLOW='\033[1;33m'
  9. NC='\033[0m' # No Color
  10. # Function to print colored output
  11. print_status() {
  12. echo -e "${GREEN}[INFO]${NC} $1"
  13. }
  14. print_warning() {
  15. echo -e "${YELLOW}[WARNING]${NC} $1"
  16. }
  17. print_error() {
  18. echo -e "${RED}[ERROR]${NC} $1"
  19. }
  20. # Navigate to project directory
  21. cd "$(dirname "$0")/.."
  22. # Stop Spring Boot application if running
  23. if [ -f .spring-boot.pid ]; then
  24. SPRING_BOOT_PID=$(cat .spring-boot.pid)
  25. if ps -p $SPRING_BOOT_PID > /dev/null; then
  26. print_status "Stopping Spring Boot application (PID: $SPRING_BOOT_PID)..."
  27. kill $SPRING_BOOT_PID
  28. rm .spring-boot.pid
  29. print_status "Spring Boot application stopped."
  30. else
  31. print_warning "Spring Boot application PID $SPRING_BOOT_PID not found."
  32. rm -f .spring-boot.pid
  33. fi
  34. fi
  35. # Stop Docker services
  36. print_status "Stopping Docker services..."
  37. docker-compose down
  38. print_status "Water Management System IoT Layer stopped successfully!"
  39. echo ""
  40. echo "🔧 System has been stopped."
  41. echo ""
  42. echo "To restart the system:"
  43. echo "- cd $(pwd)"
  44. echo "- ./scripts/start.sh"