run.sh 473 B

123456789101112131415161718
  1. #!/bin/bash
  2. while true; do
  3. # Check if the python app is running on port 5000
  4. if ! lsof -i :5000 > /dev/null; then
  5. echo "Python app is not running on port 5000. Starting it"
  6. cd /app/data/public/CommunityRuleChatBot/CommunityRuleChatBot
  7. source myvenv/bin/activate
  8. python3 run.py &
  9. else
  10. echo "Python app is already running on port 5000. Nothing to do"
  11. fi
  12. # Sleep for 30 minutes (1800 seconds)
  13. sleep 1800
  14. done