Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/build #20

Merged
merged 2 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'"

Loading