Skip to content

Commit

Permalink
chore: kill script
Browse files Browse the repository at this point in the history
  • Loading branch information
echarles committed Dec 18, 2023
1 parent be67cb6 commit 95aca5e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion dev/sh/kill.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,22 @@
# Copyright (c) Datalayer, Inc. https://datalayer.io
# Distributed under the terms of the MIT License.

uname_out="$(uname -s)"

case "${uname_out}" in
Linux*) export OS=LINUX;;
Darwin*) export OS=MACOS;;
# CYGWIN*) OS=CYGWIND;;
# MINGW*) OS=MINGW;;
*) export OS="UNSUPPORTED:${unameOut}"
esac

function kill_port() {
lsof -i TCP:$1 | grep LISTEN | awk '{print $2}' | xargs kill -9
case "${OS}" in
LINUX) fuser -k $1/tcp;;
MACOS) lsof -i TCP:$1 | grep LISTEN | awk '{print $2}' | xargs kill -9;;
*) echo "Unsupported operating system ${OS}"
esac
}

kill_port 3063
Expand Down

0 comments on commit 95aca5e

Please sign in to comment.