Skip to content

Commit cbeb4e5

Browse files
committed
🎨源码部署脚本支持客户端状态检测
1 parent 1da3910 commit cbeb4e5

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

scripts/client/check.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
CURRENT_SCRIPT_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")";pwd)
4+
TCA_SCRIPT_ROOT=${TCA_SCRIPT_ROOT:-"$(cd $(dirname $CURRENT_SCRIPT_PATH); pwd)"}
5+
TCA_PROJECT_PATH=${TCA_PROJECT_PATH:-"$(cd "$(dirname $TCA_SCRIPT_ROOT)"; pwd)"}
6+
7+
8+
source $TCA_SCRIPT_ROOT/utils.sh
9+
10+
function check_result() {
11+
name=$1
12+
ret=$2
13+
if [ "$ret" = "true" ]; then
14+
LOG_INFO "$name start: OK."
15+
return 0
16+
else
17+
LOG_ERROR "$name start: Failed."
18+
return 1
19+
fi
20+
}
21+
22+
function check_client_running() {
23+
client_result=$( check_target_process_exist "codepuppy")
24+
if [ "$client_result" = "true" ]; then
25+
return 0
26+
else
27+
return 1
28+
fi
29+
}
30+
31+
function check_tca_client_status() {
32+
client_result=""
33+
LOG_INFO "Check client start status..."
34+
check_client_running
35+
check_result "tca_client" "$client_result"
36+
}

scripts/deploy/tca_local.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ source $TCA_SCRIPT_ROOT/server/start.sh
1616
source $TCA_SCRIPT_ROOT/server/stop.sh
1717
source $TCA_SCRIPT_ROOT/server/healthcheck.sh
1818
source $TCA_SCRIPT_ROOT/client/init.sh
19+
source $TCA_SCRIPT_ROOT/client/check.sh
1920
source $TCA_SCRIPT_ROOT/client/start.sh
2021
source $TCA_SCRIPT_ROOT/client/stop.sh
2122

@@ -170,6 +171,7 @@ function tca_local_main() {
170171
tca_local_start
171172
sleep 2
172173
check_tca_local_status
174+
check_tca_client_status
173175
;;
174176
install)
175177
tca_local_install $service
@@ -182,6 +184,7 @@ function tca_local_main() {
182184
;;
183185
check)
184186
check_tca_local_status
187+
check_tca_client_status
185188
;;
186189
log)
187190
get_tca_local_log

0 commit comments

Comments
 (0)