38
38
# -----------------------------------------------------------------------------
39
39
40
40
# echo color
41
- WHITE_COLOR=" \E[1;37m" ;
42
41
RED_COLOR=" \E[1;31m" ;
43
- BLUE_COLOR=' \E[1;34m' ;
44
42
GREEN_COLOR=" \E[1;32m" ;
45
43
YELLOW_COLOR=" \E[1;33m" ;
44
+ BLUE_COLOR=' \E[1;34m' ;
45
+ WHITE_COLOR=" \E[1;37m" ;
46
46
RES=" \E[0m" ;
47
47
48
48
printf " \n\n"
@@ -53,10 +53,10 @@ printf "${RED_COLOR} (__ ) /_/ / / __/ /_/ / / / / / /> <
53
53
printf " ${RED_COLOR} /____/\__/_/ \___/\__,_/_/ /_/ /_/_/|_| ${RES} \n"
54
54
printf " ${RED_COLOR} |/ ${RES} \n"
55
55
printf " ${RED_COLOR} . ${RES} \n\n"
56
- printf " ${GREEN_COLOR } WebSite: http://www.streamxhub.com ${RES} \n"
57
- printf " ${GREEN_COLOR } GitHub : https://github.com/streamxhub/streamx ${RES} \n"
58
- printf " ${GREEN_COLOR } Gitee : https://gitee.com/streamxhub/streamx ${RES} \n"
59
- printf " ${GREEN_COLOR} [StreamX] Make Flink|Spark easier ô‿ô! ${RES} \n\n\n"
56
+ printf " ${BLUE_COLOR } WebSite: http://www.streamxhub.com ${RES} \n"
57
+ printf " ${BLUE_COLOR } GitHub : https://github.com/streamxhub/streamx ${RES} \n"
58
+ printf " ${BLUE_COLOR } Gitee : https://gitee.com/streamxhub/streamx ${RES} \n \n"
59
+ printf " ${GREEN_COLOR} ──────── Make Flink|Spark easier ô‿ô! ${RES} \n\n\n"
60
60
61
61
62
62
echo_r () {
258
258
# ----- Execute The Requested Command -----------------------------------------
259
259
260
260
# shellcheck disable=SC2120
261
- exist () {
261
+ running () {
262
262
if [ -f " $APP_PID " ]; then
263
- if [ -z " ` cat " $APP_PID " ` " ]; then
264
- return 1
263
+ if [ -s " $APP_PID " ]; then
264
+ # shellcheck disable=SC2046
265
+ # shellcheck disable=SC2006
266
+ kill -0 ` cat " $APP_PID " ` > /dev/null 2>&1
267
+ # shellcheck disable=SC2181
268
+ if [ $? -eq 0 ]; then
269
+ return 1
270
+ else
271
+ return 0
272
+ fi
265
273
else
266
274
return 0
267
275
fi
268
276
else
269
- return 1
277
+ return 0
270
278
fi
271
279
}
272
280
273
281
# shellcheck disable=SC2120
274
282
start () {
275
- exist
283
+ running
276
284
# shellcheck disable=SC2181
277
- if [ $? -eq " 0 " ]; then
285
+ if [ $? -eq " 1 " ]; then
278
286
# shellcheck disable=SC2006
279
287
echo_r " StreamX is already running pid: ` cat " $APP_PID " ` "
280
288
exit 1
@@ -417,9 +425,9 @@ start() {
417
425
418
426
# shellcheck disable=SC2120
419
427
stop () {
420
- exist
428
+ running
421
429
# shellcheck disable=SC2181
422
- if [ $? -eq " 1 " ]; then
430
+ if [ $? -eq " 0 " ]; then
423
431
echo_r " StreamX is not running."
424
432
exit 1
425
433
fi
@@ -494,7 +502,7 @@ stop () {
494
502
if [ -f " $APP_PID " ]; then
495
503
PID=` cat " $APP_PID " `
496
504
echo_y " Killing StreamX with the PID: $PID "
497
- kill -9 " $PID "
505
+ kill -9 " $PID " > /dev/null 2>&1
498
506
while [ $KILL_SLEEP_INTERVAL -ge 0 ]; do
499
507
kill -0 ` cat " $APP_PID " ` > /dev/null 2>&1
500
508
if [ $? -gt 0 ]; then
@@ -539,11 +547,11 @@ stop () {
539
547
}
540
548
541
549
status () {
542
- exist
550
+ running
543
551
# shellcheck disable=SC2181
544
- if [ $? -eq " 0 " ]; then
552
+ if [ $? -eq " 1 " ]; then
545
553
# shellcheck disable=SC2006
546
- echo_g " StreamX is running PID is: ` cat " $APP_PID " ` "
554
+ echo_g " StreamX is running pid is: ` cat " $APP_PID " ` "
547
555
else
548
556
echo_r " StreamX is not running"
549
557
fi
0 commit comments