Spaces:
Sleeping
Sleeping
File size: 962 Bytes
ed8900a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
#!/bin/bash
# Amazon Linux에서 uvicorn 프로세스 찾기 및 종료
echo "Stopping uvicorn process..."
uvicorn_pids=$(ps -ef | grep uvicorn | grep -v grep | awk '{print $2}')
if [ -n "$uvicorn_pids" ]; then
echo "Found uvicorn processes with PIDs: $uvicorn_pids"
for pid in $uvicorn_pids; do
echo "Stopping PID: $pid"
kill -15 $pid
# 프로세스가 완전히 종료될 때까지 기다림
echo "Waiting for process to terminate..."
sleep 3
# 만약 프로세스가 여전히 살아있다면 강제 종료
if ps -p $pid > /dev/null 2>&1; then
echo "Force killing uvicorn process..."
kill -9 $pid
fi
done
echo "All uvicorn processes stopped."
else
echo "No uvicorn process found running."
fi
# run-service.sh 실행
echo "Starting service with run-service.sh..."
bash ./run-service.sh
echo "Service restart completed."
|