35 lines
767 B
Bash
Executable File
35 lines
767 B
Bash
Executable File
#!/bin/zsh
|
|
|
|
FORCE_KILL=false
|
|
|
|
# Parse command line options
|
|
while getopts ":f" opt; do
|
|
case ${opt} in
|
|
f )
|
|
FORCE_KILL=true
|
|
;;
|
|
\? )
|
|
echo "Usage: cmd [-f]"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ "$FORCE_KILL" = true ] ; then
|
|
echo "Attempting to kill process on port 8081..."
|
|
# Get PID of process using port 8081 and kill it
|
|
# -t option for lsof outputs only the PID
|
|
# xargs -r ensures kill is only run if lsof finds a PID
|
|
lsof -t -i:8081 | xargs -r kill -9
|
|
if [ $? -eq 0 ]; then
|
|
echo "Process(es) on port 8081 killed."
|
|
else
|
|
echo "No process found on port 8081 or failed to kill."
|
|
fi
|
|
# Give a moment for the port to be released
|
|
sleep 1
|
|
fi
|
|
|
|
echo "Starting Flowbroker server..."
|
|
cargo run
|