dk-image-worldcup / restart.sh
ilhee's picture
재시작 script 추가.
ed8900a
raw
history blame contribute delete
962 Bytes
#!/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."