File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Required parameters:
4+ # @raycast.schemaVersion 1
5+ # @raycast.title Kill a process on PORT
6+ # @raycast.mode compact
7+
8+ # Optional parameters:
9+ # @raycast.icon 🚫
10+ # @raycast.argument1 { "type": "text", "placeholder": "Ports (e.g. 3000 5000)" }
11+
12+ # Documentation:
13+ # @raycast.description Kill running processes on the given ports
14+ # @raycast.author aaqifshafi
15+ # @raycast.authorURL https://github.com/aaqifshafi
16+
17+ if [ $# -eq 0 ]; then
18+ echo " Provide at least one port number."
19+ exit 1
20+ fi
21+
22+ for port in " $@ "
23+ do
24+ pid=$( lsof -ti tcp:$port )
25+ if [ -n " $pid " ]; then
26+ kill -9 $pid
27+ echo " Killed process $pid on port $port "
28+ else
29+ echo " No process found on port $port "
30+ fi
31+ done
You can’t perform that action at this time.
0 commit comments