#!/bin/bash PID=$(cat flask.pid) kill $PID processes=$(lsof -ti :5000) if [ -z "$processes" ]; then echo "No processes" else echo "$processes" for pid in $processes; do kill $pid done fi rm "flask.pid"