-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from TG-WinG/feature/build
feat: 배포 스크립트에 복구 기능 추가
- Loading branch information
Showing
5 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
sudo mv server.jar server.bak.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
# | ||
# use this script when new jar file exit with unexpected error. | ||
|
||
script_dir=$(dirname "$0") | ||
|
||
if [ -f "server.bak.jar" ]; then | ||
sudo mv server.bak.jar server.jar | ||
echo "backup jar recovered." | ||
"${script_dir}/runner.sh" server.jar | ||
exit_code=$? | ||
|
||
if [ $exit_code -ne 0 ]; then | ||
echo "recovory fail: error occured starting backup jar." | ||
exit 1 | ||
fi | ||
|
||
exit 0 | ||
fi | ||
|
||
echo "recovory fail: no backup jar file found" | ||
exit 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
#!/bin/bash | ||
|
||
nohup java -jar $1 --spring.profiles.active=dev 2>&1 & | ||
nohup java -jar $1 --spring.profiles.active=dev 2>&1 > out.log & | ||
|
||
echo "waiting for server to startup..." | ||
sleep 60 | ||
|
||
# after sleep, check server is still running. | ||
pid=$(sudo lsof -t -i :8080) | ||
|
||
if [ -z "$pid" ]; then | ||
echo "!server startup failed!" | ||
echo "check out.log to see what happend." | ||
exit 1 | ||
fi | ||
|
||
echo "${pid} is successfully running on port 8080." | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
# | ||
# startup fresh deployed jar file | ||
|
||
script_dir=$(dirname "$0") | ||
|
||
"${script_dir}/runner.sh" server.jar | ||
exit_code=$? | ||
|
||
if [ $exit_code -ne 0 ]; then | ||
"${script_dir}/recover.sh" | ||
exit 1 | ||
fi |