run.sh 481 B

12345678910111213141516171819
  1. #!/bin/bash
  2. while true; do
  3. # Check if the Node.js app is running on port 3000
  4. if ! lsof -i :3000 > /dev/null; then
  5. echo "Node.js app is not running on port 3000. Starting it"
  6. cd /app/data/public/communityRuleBackend
  7. node app.js &
  8. else
  9. echo "$(lsof -i :3000)"
  10. echo "(lsof -i :3000)"
  11. echo "Node.js app is already running on port 3000. Nothing to do"
  12. fi
  13. # Sleep for 30 minutes (1800 seconds)
  14. sleep 1800
  15. done