From 6d78a9f23a9f2f75b6ad54a051e2876250b7a5ab Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 17 Nov 2023 21:36:43 +0800 Subject: [PATCH] 1 --- scripts/publish_pm2_cpp_z_n_i/boundle.sh | 16 ++++++++++++++++ .../publish_pm2_cpp_z_n_i/ecosystem.config.js | 13 +++++++++++++ scripts/publish_pm2_cpp_z_n_i/reload.sh | 0 scripts/publish_pm2_cpp_z_n_i/restart.sh | 16 ++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 scripts/publish_pm2_cpp_z_n_i/boundle.sh create mode 100644 scripts/publish_pm2_cpp_z_n_i/ecosystem.config.js create mode 100644 scripts/publish_pm2_cpp_z_n_i/reload.sh create mode 100755 scripts/publish_pm2_cpp_z_n_i/restart.sh diff --git a/scripts/publish_pm2_cpp_z_n_i/boundle.sh b/scripts/publish_pm2_cpp_z_n_i/boundle.sh new file mode 100644 index 0000000..0b2bf2a --- /dev/null +++ b/scripts/publish_pm2_cpp_z_n_i/boundle.sh @@ -0,0 +1,16 @@ +source ./common.sh + +cd ${SOURCE_PATH} +${PRE_COMPILE_CMD} +cmake ${COMPILE_FLAGS} +make clean +make +cp ../bin/${SRC_EXE_NAME} ../../../../bin/${PROJECT_NAME} + +cd ../../../../ + +tag_name=`git status |grep '# On branch '|sed 's/# On branch //g'` +dir_name=`basename $PWD` +package_name=${dir_name}.tar.gz + +tar --exclude=*.git -chzf target/${package_name} bin common.sh reload.sh restart.sh ecosystem.config.js config ${EXT_PKG_FILES} diff --git a/scripts/publish_pm2_cpp_z_n_i/ecosystem.config.js b/scripts/publish_pm2_cpp_z_n_i/ecosystem.config.js new file mode 100644 index 0000000..e3de0be --- /dev/null +++ b/scripts/publish_pm2_cpp_z_n_i/ecosystem.config.js @@ -0,0 +1,13 @@ +const appName = process.argv[5]; +const n = process.argv[6]; +const i = process.argv[7]; +const execName = process.argv[8]; + +module.exports = { + apps: [{ + name: appName, + args: `-n${n} -i${i}`, + script: './' + execName, + cwd: 'bin' + }] +}; diff --git a/scripts/publish_pm2_cpp_z_n_i/reload.sh b/scripts/publish_pm2_cpp_z_n_i/reload.sh new file mode 100644 index 0000000..e69de29 diff --git a/scripts/publish_pm2_cpp_z_n_i/restart.sh b/scripts/publish_pm2_cpp_z_n_i/restart.sh new file mode 100755 index 0000000..7d71d76 --- /dev/null +++ b/scripts/publish_pm2_cpp_z_n_i/restart.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +source ./common.sh + +ps -ef|grep ${PROJECT_NAME} > bin/ps.log + +instances=(${1//,/ }) +n=$2 + +for i in ${instances[@]} +do + pm2 delete ecosystem.config.js --only ${PROJECT_NAME}_n${n}_i${i} $n $i ${PROJECT_NAME} + pm2 start ecosystem.config.js --only ${PROJECT_NAME}_n${n}_i${i} $n $i ${PROJECT_NAME} +done + +echo 'success'