Skip to content

Commit

Permalink
fix: check_and_recover.sh 에 외부 스크립트 병합
Browse files Browse the repository at this point in the history
  • Loading branch information
wwingyou committed Mar 25, 2024
1 parent cefdd77 commit 05e1050
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions JWT/deploy/check_and_recover.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,32 @@

# 서버의 상태를 확인하여 실행시 실패했다면 복구한다.

script_dir=$(dirname "$0")
"${script_dir}/check.sh"
exit_code=$?
pid=$(sudo lsof -t -i :8080)

if [ -z "$pid" ]; then
echo "Error: server is not running."

if [ $exit_code -ne 0 ]; then
echo
echo "========= ERROR LOG =========="
cat out.log
"${script_dir}/recover.sh"
exit 1
echo "========== LOG END ==========="
echo

script_dir=$(dirname "$0")

if [ -f "server.bak.jar" ]; then
sudo mv server.bak.jar server.jar
echo "backup jar recovered."

nohup java -jar server.jar --spring.profiles.active=dev 2>&1 > out.log &
echo "backup server no running on port 8080"
exit 0
fi

echo "recovory fail: no backup jar file found"
exit 2

fi

echo "PID '${pid}' is running on port 8080."

0 comments on commit 05e1050

Please sign in to comment.