From f50138243c9bfc94a65a5993e425d78acbb8bad6 Mon Sep 17 00:00:00 2001 From: linlinjava Date: Sun, 29 Nov 2020 11:12:07 +0800 Subject: [PATCH] chore --- deploy/bin/deploy.sh | 14 +++++++++----- deploy/bin/reset.sh | 1 + deploy/bin/stop.sh | 8 ++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 deploy/bin/stop.sh diff --git a/deploy/bin/deploy.sh b/deploy/bin/deploy.sh index 4105e33c..7f3dc7a2 100644 --- a/deploy/bin/deploy.sh +++ b/deploy/bin/deploy.sh @@ -1,8 +1,12 @@ #!/bin/bash # 本脚本的作用是停止当前Spring Boot应用,然后再次部署 -sudo service litemall stop -sudo ln -f -s /home/ubuntu/deploy/litemall/litemall.jar /etc/init.d/litemall -sudo update-rc.d litemall defaults -sudo update-rc.d litemall enable -sudo service litemall start \ No newline at end of file +PID=$(ps -ef | grep litemall.jar | grep -v grep | awk '{ print $2 }') + +if [ ! -z "$PID" ] +then + kill $PID +fi + +cd /home/ubuntu/deploy/litemall || exit 2 +nohup java -jar litemall.jar > log.log 2>&1 & \ No newline at end of file diff --git a/deploy/bin/reset.sh b/deploy/bin/reset.sh index 4ac1a1a2..aeea43a5 100644 --- a/deploy/bin/reset.sh +++ b/deploy/bin/reset.sh @@ -28,4 +28,5 @@ rm -f ./** # 重新部署服务 cd /home/ubuntu/deploy/bin || exit 2 +sudo ./stop.sh sudo ./deploy.sh \ No newline at end of file diff --git a/deploy/bin/stop.sh b/deploy/bin/stop.sh new file mode 100644 index 00000000..82ab3f5f --- /dev/null +++ b/deploy/bin/stop.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +PID=$(ps -ef | grep litemall.jar | grep -v grep | awk '{ print $2 }') + +if [ ! -z "$PID" ] +then + kill $PID +fi \ No newline at end of file