diff --git a/stop_flask.sh b/stop_flask.sh new file mode 100644 index 0000000000000000000000000000000000000000..2fabd5e3b974afe576adaa61d83144204f9d75db --- /dev/null +++ b/stop_flask.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Find the PID of the Flask application using lsof +FLASK_PID=$(lsof -t -i :8080) + +if [ -z "$FLASK_PID" ]; then + echo "Flask application is not running on port 8080" +else + # Terminate the Flask application + kill $FLASK_PID + + # Wait for a moment to ensure the process has been terminated + sleep 2 + + # Check if the process is still running + if lsof -i :8080 > /dev/null; then + echo "Failed to terminate Flask application, forcing termination" + kill -9 $FLASK_PID + else + echo "Flask application terminated successfully" + fi +fi \ No newline at end of file