Skip to content

Commit

Permalink
streamx.sh get pid bug fixed. (apache#380)
Browse files Browse the repository at this point in the history
* streamx.sh provided more operations
* streamx.sh get pid bug fixed.
  • Loading branch information
wolfboys authored Oct 24, 2021
1 parent e0fad5d commit 9df0e5b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 35 deletions.
36 changes: 19 additions & 17 deletions .mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
* Copyright (c) 2019 The StreamX Project
* <p>
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import java.io.File;
import java.io.FileInputStream;
Expand Down
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
44 changes: 26 additions & 18 deletions streamx-console/streamx-console-service/src/assembly/bin/streamx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
# -----------------------------------------------------------------------------

#echo color
WHITE_COLOR="\E[1;37m";
RED_COLOR="\E[1;31m";
BLUE_COLOR='\E[1;34m';
GREEN_COLOR="\E[1;32m";
YELLOW_COLOR="\E[1;33m";
BLUE_COLOR='\E[1;34m';
WHITE_COLOR="\E[1;37m";
RES="\E[0m";

printf "\n\n"
Expand All @@ -53,10 +53,10 @@ printf "${RED_COLOR} (__ ) /_/ / / __/ /_/ / / / / / /> <
printf "${RED_COLOR} /____/\__/_/ \___/\__,_/_/ /_/ /_/_/|_| ${RES}\n"
printf "${RED_COLOR} |/ ${RES}\n"
printf "${RED_COLOR} . ${RES}\n\n"
printf "${GREEN_COLOR} WebSite: http://www.streamxhub.com ${RES}\n"
printf "${GREEN_COLOR} GitHub : https://github.com/streamxhub/streamx ${RES}\n"
printf "${GREEN_COLOR} Gitee : https://gitee.com/streamxhub/streamx ${RES}\n"
printf "${GREEN_COLOR} [StreamX] Make Flink|Spark easier ô‿ô! ${RES}\n\n\n"
printf "${BLUE_COLOR} WebSite: http://www.streamxhub.com ${RES}\n"
printf "${BLUE_COLOR} GitHub : https://github.com/streamxhub/streamx ${RES}\n"
printf "${BLUE_COLOR} Gitee : https://gitee.com/streamxhub/streamx ${RES}\n\n"
printf "${GREEN_COLOR} ──────── Make Flink|Spark easier ô‿ô! ${RES}\n\n\n"


echo_r () {
Expand Down Expand Up @@ -258,23 +258,31 @@ fi
# ----- Execute The Requested Command -----------------------------------------

# shellcheck disable=SC2120
exist() {
running() {
if [ -f "$APP_PID" ]; then
if [ -z "`cat "$APP_PID"`" ]; then
return 1
if [ -s "$APP_PID" ]; then
# shellcheck disable=SC2046
# shellcheck disable=SC2006
kill -0 `cat "$APP_PID"` >/dev/null 2>&1
# shellcheck disable=SC2181
if [ $? -eq 0 ]; then
return 1
else
return 0
fi
else
return 0
fi
else
return 1
return 0
fi
}

# shellcheck disable=SC2120
start() {
exist
running
# shellcheck disable=SC2181
if [ $? -eq "0" ]; then
if [ $? -eq "1" ]; then
# shellcheck disable=SC2006
echo_r "StreamX is already running pid: `cat "$APP_PID"`"
exit 1
Expand Down Expand Up @@ -417,9 +425,9 @@ start() {

# shellcheck disable=SC2120
stop () {
exist
running
# shellcheck disable=SC2181
if [ $? -eq "1" ]; then
if [ $? -eq "0" ]; then
echo_r "StreamX is not running."
exit 1
fi
Expand Down Expand Up @@ -494,7 +502,7 @@ stop () {
if [ -f "$APP_PID" ]; then
PID=`cat "$APP_PID"`
echo_y "Killing StreamX with the PID: $PID"
kill -9 "$PID"
kill -9 "$PID" >/dev/null 2>&1
while [ $KILL_SLEEP_INTERVAL -ge 0 ]; do
kill -0 `cat "$APP_PID"` >/dev/null 2>&1
if [ $? -gt 0 ]; then
Expand Down Expand Up @@ -539,11 +547,11 @@ stop () {
}

status () {
exist
running
# shellcheck disable=SC2181
if [ $? -eq "0" ]; then
if [ $? -eq "1" ]; then
# shellcheck disable=SC2006
echo_g "StreamX is running PID is: `cat "$APP_PID"`"
echo_g "StreamX is running pid is: `cat "$APP_PID"`"
else
echo_r "StreamX is not running"
fi
Expand Down

0 comments on commit 9df0e5b

Please sign in to comment.