Skip to content

Commit 9df0e5b

Browse files
authored
streamx.sh get pid bug fixed. (apache#380)
* streamx.sh provided more operations * streamx.sh get pid bug fixed.
1 parent e0fad5d commit 9df0e5b

File tree

3 files changed

+45
-35
lines changed

3 files changed

+45
-35
lines changed

.mvn/wrapper/MavenWrapperDownloader.java

+19-17
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
/*
2-
Licensed to the Apache Software Foundation (ASF) under one
3-
or more contributor license agreements. See the NOTICE file
4-
distributed with this work for additional information
5-
regarding copyright ownership. The ASF licenses this file
6-
to you under the Apache License, Version 2.0 (the
7-
"License"); you may not use this file except in compliance
8-
with the License. You may obtain a copy of the License at
9-
10-
https://www.apache.org/licenses/LICENSE-2.0
11-
12-
Unless required by applicable law or agreed to in writing,
13-
software distributed under the License is distributed on an
14-
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
KIND, either express or implied. See the License for the
16-
specific language governing permissions and limitations
17-
under the License.
18-
*/
2+
* Copyright (c) 2019 The StreamX Project
3+
* <p>
4+
* Licensed to the Apache Software Foundation (ASF) under one
5+
* or more contributor license agreements. See the NOTICE file
6+
* distributed with this work for additional information
7+
* regarding copyright ownership. The ASF licenses this file
8+
* to you under the Apache License, Version 2.0 (the
9+
* "License"); you may not use this file except in compliance
10+
* with the License. You may obtain a copy of the License at
11+
* <p>
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
* <p>
14+
* Unless required by applicable law or agreed to in writing,
15+
* software distributed under the License is distributed on an
16+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
* KIND, either express or implied. See the License for the
18+
* specific language governing permissions and limitations
19+
* under the License.
20+
*/
1921

2022
import java.io.File;
2123
import java.io.FileInputStream;

.mvn/wrapper/maven-wrapper.jar

47.2 KB
Binary file not shown.

streamx-console/streamx-console-service/src/assembly/bin/streamx.sh

+26-18
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838
# -----------------------------------------------------------------------------
3939

4040
#echo color
41-
WHITE_COLOR="\E[1;37m";
4241
RED_COLOR="\E[1;31m";
43-
BLUE_COLOR='\E[1;34m';
4442
GREEN_COLOR="\E[1;32m";
4543
YELLOW_COLOR="\E[1;33m";
44+
BLUE_COLOR='\E[1;34m';
45+
WHITE_COLOR="\E[1;37m";
4646
RES="\E[0m";
4747

4848
printf "\n\n"
@@ -53,10 +53,10 @@ printf "${RED_COLOR} (__ ) /_/ / / __/ /_/ / / / / / /> <
5353
printf "${RED_COLOR} /____/\__/_/ \___/\__,_/_/ /_/ /_/_/|_| ${RES}\n"
5454
printf "${RED_COLOR} |/ ${RES}\n"
5555
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"
6060

6161

6262
echo_r () {
@@ -258,23 +258,31 @@ fi
258258
# ----- Execute The Requested Command -----------------------------------------
259259

260260
# shellcheck disable=SC2120
261-
exist() {
261+
running() {
262262
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
265273
else
266274
return 0
267275
fi
268276
else
269-
return 1
277+
return 0
270278
fi
271279
}
272280

273281
# shellcheck disable=SC2120
274282
start() {
275-
exist
283+
running
276284
# shellcheck disable=SC2181
277-
if [ $? -eq "0" ]; then
285+
if [ $? -eq "1" ]; then
278286
# shellcheck disable=SC2006
279287
echo_r "StreamX is already running pid: `cat "$APP_PID"`"
280288
exit 1
@@ -417,9 +425,9 @@ start() {
417425

418426
# shellcheck disable=SC2120
419427
stop () {
420-
exist
428+
running
421429
# shellcheck disable=SC2181
422-
if [ $? -eq "1" ]; then
430+
if [ $? -eq "0" ]; then
423431
echo_r "StreamX is not running."
424432
exit 1
425433
fi
@@ -494,7 +502,7 @@ stop () {
494502
if [ -f "$APP_PID" ]; then
495503
PID=`cat "$APP_PID"`
496504
echo_y "Killing StreamX with the PID: $PID"
497-
kill -9 "$PID"
505+
kill -9 "$PID" >/dev/null 2>&1
498506
while [ $KILL_SLEEP_INTERVAL -ge 0 ]; do
499507
kill -0 `cat "$APP_PID"` >/dev/null 2>&1
500508
if [ $? -gt 0 ]; then
@@ -539,11 +547,11 @@ stop () {
539547
}
540548

541549
status () {
542-
exist
550+
running
543551
# shellcheck disable=SC2181
544-
if [ $? -eq "0" ]; then
552+
if [ $? -eq "1" ]; then
545553
# 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"`"
547555
else
548556
echo_r "StreamX is not running"
549557
fi

0 commit comments

Comments
 (0)