From 8b1595a0440f62169c05940539e5d13c8e9dd68c Mon Sep 17 00:00:00 2001 From: YDKD <1606354057@qq.com> Date: Tue, 12 Apr 2022 09:58:50 +0800 Subject: [PATCH] build(jenkins): optimization memory manage --- jenkins/script/build-dev.sh | 6 ------ jenkins/script/restart.sh | 13 +++++++++++++ jenkins/script/stop.sh | 14 ++++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100755 jenkins/script/restart.sh create mode 100755 jenkins/script/stop.sh diff --git a/jenkins/script/build-dev.sh b/jenkins/script/build-dev.sh index fa11f2a..83d9e13 100755 --- a/jenkins/script/build-dev.sh +++ b/jenkins/script/build-dev.sh @@ -1,12 +1,6 @@ #! /bin/bash # set -x -# stop nestjs -docker stop nestjs - npm run build-dev || exit 1 -# start nestjs -docker start nestjs - # set +x diff --git a/jenkins/script/restart.sh b/jenkins/script/restart.sh new file mode 100755 index 0000000..e97c9d0 --- /dev/null +++ b/jenkins/script/restart.sh @@ -0,0 +1,13 @@ +#! /bin/bash + +# set -x +# restart mysql +docker start mysql + +# restart nestjs +containerId=`docker ps -a | grep -w nestjs | awk '{print $1}'` + +if [ "$containerId" != "" ] ; then + docker start $containerId + echo "成功运行容器 $containerId" +fi diff --git a/jenkins/script/stop.sh b/jenkins/script/stop.sh new file mode 100755 index 0000000..2d0ad01 --- /dev/null +++ b/jenkins/script/stop.sh @@ -0,0 +1,14 @@ +#! /bin/bash + +# set -x +# stop nestjs +containerId=`docker ps -a | grep -w nestjs | awk '{print $1}'` + +if [ "$containerId" != "" ] ; then + docker stop $containerId + echo "成功停止容器 $containerId" +fi + +# stop mysql +docker stop mysql +