Skip to content

Commit c3aec7d

Browse files
committed
chore: kill script
1 parent 74970ea commit c3aec7d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

dev/kill-jupyter-server.sh

+15-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,22 @@
33
# Copyright (c) Datalayer, Inc. https://datalayer.io
44
# Distributed under the terms of the MIT License.
55

6+
uname_out="$(uname -s)"
7+
8+
case "${uname_out}" in
9+
Linux*) export OS=LINUX;;
10+
Darwin*) export OS=MACOS;;
11+
# CYGWIN*) OS=CYGWIND;;
12+
# MINGW*) OS=MINGW;;
13+
*) export OS="UNSUPPORTED:${unameOut}"
14+
esac
15+
616
function kill_port() {
7-
lsof -i TCP:$1 | grep LISTEN | awk '{print $2}' | xargs kill -9
17+
case "${OS}" in
18+
LINUX) fuser -k $1/tcp;;
19+
MACOS) lsof -i TCP:$1 | grep LISTEN | awk '{print $2}' | xargs kill -9;;
20+
*) echo "Unsupported operating system ${OS}"
21+
esac
822
}
923

1024
kill_port 8888

0 commit comments

Comments
 (0)