fix: cleanup fp command
This commit is contained in:
parent
1b30f4b7b1
commit
24afcffe52
@ -2,33 +2,26 @@
|
|||||||
|
|
||||||
function fp(){
|
function fp(){
|
||||||
|
|
||||||
for p in "$@"
|
if [ "$(which lsof)" = "lsof not found" ]; then
|
||||||
do
|
echo "lsof not installed"
|
||||||
|
else
|
||||||
PORT=$var;
|
for PORT in "$@"
|
||||||
|
do
|
||||||
if [ "$(which lsof)" = "lsof not found" ]; then
|
if [ "$PORT" != "" ]; then
|
||||||
echo "lsof not installed"
|
#echo "checking ($PORT)"
|
||||||
else
|
PIDS="$(lsof -t -i:$PORT)"
|
||||||
PIDS="$(lsof -t -i:$PORT)"
|
AMOUNT=$(wc -w<<<$PIDS);
|
||||||
|
|
||||||
AMOUNT=$(wc -w<<<$PIDS);
|
|
||||||
|
|
||||||
if [ $AMOUNT = 0 ]; then
|
|
||||||
|
|
||||||
echo "No processes use port $PORT";
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
echo "Killing $AMOUNT process(es) using port $PORT";
|
|
||||||
|
|
||||||
echo "$PIDS" | while IFS= read -r pid ; do
|
|
||||||
kill -9 $pid;
|
|
||||||
done
|
|
||||||
|
|
||||||
|
if [ $AMOUNT = 0 ]; then
|
||||||
|
echo "No processes use port $PORT";
|
||||||
|
else
|
||||||
|
echo "Killing $AMOUNT process(es) using port $PORT";
|
||||||
|
echo "$PIDS" | while IFS= read -r pid ; do
|
||||||
|
kill -9 $pid;
|
||||||
|
done
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
done
|
||||||
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user