teaching-materials / stop_server.sh
iurbinah's picture
add stop server
3ab1be0
raw
history blame contribute delete
365 Bytes
#!/bin/bash
# This script finds and stops the running Python web server.
# Find the Process ID (PID) of the server script
PID=$(pgrep -f 'server/server.py')
# Check if a PID was found
if [ -z "$PID" ]; then
echo "Server is not currently running."
else
# Kill the process and print a confirmation
kill $PID
echo "Server with PID $PID has been stopped."
fi