Skip to content

Commit

Permalink
Merge pull request #20 from TG-WinG/feature/build
Browse files Browse the repository at this point in the history
Feature/build
  • Loading branch information
wwingyou authored Mar 25, 2024
2 parents 1026fa1 + 05e1050 commit 0731f2c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 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."

2 changes: 1 addition & 1 deletion JWT/deploy/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ -n "$pid" ]; then
exit 1
fi

nohup java -jar $1 --spring.profiles.active=dev 2>&1 > out.log &
nohup java -jar server.jar --spring.profiles.active=dev 2>&1 > out.log &
echo "server started at port 8080."
echo "stdout & stderr directed to 'out.log'"

0 comments on commit 0731f2c

Please sign in to comment.