Skip to content

Commit

Permalink
update auto-deployment.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
wwingyou committed Mar 25, 2024
1 parent 1656554 commit 3063858
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/auto-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ jobs:
scp -i private_key.pem $jarPath "${username}@${host}:~/server.jar"
- name: Startup new uploaded jar
run: ssh -i private_key.pem "${username}@${host}" "deploy/startup.sh"
run: ssh -i private_key.pem "${username}@${host}" "source ~/.profile; deploy/startup.sh"

- name: Wait 30 seconds for server to startup
run: sleep 30

- name: Check and Recover
run: ssh -i private_key.pem "${username}@${host}" "deploy/check_and_recover.sh"
run: ssh -i private_key.pem "${username}@${host}" "source ~/.profile; deploy/check_and_recover.sh"
5 changes: 2 additions & 3 deletions JWT/deploy/check_and_recover.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ if [ -z "$pid" ]; 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
"${script_dir}/startup.sh"
exit 1
fi

echo "recovory fail: no backup jar file found"
Expand Down
4 changes: 1 addition & 3 deletions JWT/deploy/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ if [ -n "$pid" ]; then
echo "Error: PID '${pid}' is conneted to port 8080. cannot startup new process."
exit 1
fi

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

0 comments on commit 3063858

Please sign in to comment.