#!/bin/bash while true; do # Check if the Node.js app is running on port 3000 if ! lsof -i :3000 > /dev/null; then echo "Node.js app is not running on port 3000. Starting it" cd /app/data/public/communityRuleBackend node app.js & else echo "$(lsof -i :3000)" echo "(lsof -i :3000)" echo "Node.js app is already running on port 3000. Nothing to do" fi # Sleep for 30 minutes (1800 seconds) sleep 1800 done