From de0cdc28b488fdc05f146b39e81fa18dd02f4159 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 27 Oct 2020 17:57:17 +0800 Subject: [PATCH] 1 --- scripts/publish_golang/boundle.sh | 31 +++++++++++++++++++++++++++++++ scripts/publish_golang/reload.sh | 3 +++ scripts/publish_golang/restart.sh | 17 +++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 scripts/publish_golang/boundle.sh create mode 100755 scripts/publish_golang/reload.sh create mode 100755 scripts/publish_golang/restart.sh diff --git a/scripts/publish_golang/boundle.sh b/scripts/publish_golang/boundle.sh new file mode 100644 index 0000000..e01442c --- /dev/null +++ b/scripts/publish_golang/boundle.sh @@ -0,0 +1,31 @@ +source ./common.sh + +work_dir=`pwd` +dir_name=`basename $PWD` + +if [ -f "custom_init.sh" ]; then + source ./custom_init.sh +fi + +reg='\.*D[1-9]$' +if [[ $dir_name =~ $reg ]] +then + touch bin/is_test_env + cd ${SOURCE_DIR} + git pull + git checkout release + cd $work_dir +fi + +cd ${SOURCE_PATH} +echo ${PRE_COMPILE_CMD}|sh +echo ${COMPILE_CMD}|sh +pwd +echo ${POST_COMPILE_CMD}|sh +pwd +cd $work_dir + +tag_name=`git status |grep '# On branch '|sed 's/# On branch //g'` +package_name=${dir_name}.tar.gz + +tar --exclude=*.git -chzf target/${package_name} bin common.sh reload.sh restart.sh start_instance.sh config ${EXT_PKG_FILES} diff --git a/scripts/publish_golang/reload.sh b/scripts/publish_golang/reload.sh new file mode 100755 index 0000000..74269d3 --- /dev/null +++ b/scripts/publish_golang/reload.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo 'success' diff --git a/scripts/publish_golang/restart.sh b/scripts/publish_golang/restart.sh new file mode 100755 index 0000000..7842644 --- /dev/null +++ b/scripts/publish_golang/restart.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +source ./common.sh + +pid=$(ps -ef|grep "${EXE_NAME} -n $2 -i $1"|grep -v grep|awk '{print $2}') +echo $pid + +if [[ $pid != "" ]] +then + echo $pid|xargs kill -9 +else + echo "pid 为空" +fi + +nohup ./${EXE_NAME} -n $2 -i $1 >> ${EXE_NAME}$2_$1.out & + +echo 'success'