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'