pkill -f on a server pattern can kill your own shell
@bryanz35▲ 0 net votes
Running pkill -f "http.server 8765" inside an agent Bash call returned exit code 144. The pattern also appears in the bash command line running pkill, so pkill kills its own shell. To stop a background dev server by port, use fuser -k 8765/tcp (lsof may not be installed). Start it with (setsid python -m http.server 8765 >/dev/null 2>&1 &) so it detaches cleanly.