You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by gw...@apache.org on 2016/08/26 03:23:09 UTC
kafka git commit: KAFKA-3742: (FIX) Can't run bin/connect-*.sh with
-daemon flag
Repository: kafka
Updated Branches:
refs/heads/trunk c80649078 -> dca63fc0a
KAFKA-3742: (FIX) Can't run bin/connect-*.sh with -daemon flag
## Problem
Current connect scripts (`connect-distributed.sh`, `connect-standalone.sh`) do not support `-daemon` flag even if users specify the flag
since `kafka-run-class.sh` requires that the`-daemon` flag should precede other arguments (e.g. class name)
## Solution
Do the same thing like in `kafka-server-start.sh`
- Parse a command
- Add `-daemon` to `$EXTRA_ARGS` if exists
Author: 1ambda <1a...@gmail.com>
Reviewers: Gwen Shapira
Closes #1717 from 1ambda/KAFKA-3742-connect-running-as-daemon
Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/dca63fc0
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/dca63fc0
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/dca63fc0
Branch: refs/heads/trunk
Commit: dca63fc0a50fe268b82ae5bdafa0b876f6389907
Parents: c806490
Author: 1ambda <1a...@gmail.com>
Authored: Thu Aug 25 20:23:05 2016 -0700
Committer: Gwen Shapira <cs...@gmail.com>
Committed: Thu Aug 25 20:23:05 2016 -0700
----------------------------------------------------------------------
bin/connect-distributed.sh | 20 +++++++++++++++++++-
bin/connect-standalone.sh | 20 +++++++++++++++++++-
2 files changed, 38 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kafka/blob/dca63fc0/bin/connect-distributed.sh
----------------------------------------------------------------------
diff --git a/bin/connect-distributed.sh b/bin/connect-distributed.sh
index d9f6325..99cd27b 100755
--- a/bin/connect-distributed.sh
+++ b/bin/connect-distributed.sh
@@ -14,10 +14,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+if [ $# -lt 1 ];
+then
+ echo "USAGE: $0 [-daemon] connect-distributed.properties"
+ exit 1
+fi
+
base_dir=$(dirname $0)
if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then
export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/connect-log4j.properties"
fi
-exec $(dirname $0)/kafka-run-class.sh org.apache.kafka.connect.cli.ConnectDistributed "$@"
+EXTRA_ARGS=${EXTRA_ARGS-'-name connectDistributed'}
+
+COMMAND=$1
+case $COMMAND in
+ -daemon)
+ EXTRA_ARGS="-daemon "$EXTRA_ARGS
+ shift
+ ;;
+ *)
+ ;;
+esac
+
+exec $(dirname $0)/kafka-run-class.sh $EXTRA_ARGS org.apache.kafka.connect.cli.ConnectDistributed "$@"
http://git-wip-us.apache.org/repos/asf/kafka/blob/dca63fc0/bin/connect-standalone.sh
----------------------------------------------------------------------
diff --git a/bin/connect-standalone.sh b/bin/connect-standalone.sh
index a14df86..623562a 100755
--- a/bin/connect-standalone.sh
+++ b/bin/connect-standalone.sh
@@ -14,10 +14,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+if [ $# -lt 1 ];
+then
+ echo "USAGE: $0 [-daemon] connect-standalone.properties"
+ exit 1
+fi
+
base_dir=$(dirname $0)
if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then
export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/connect-log4j.properties"
fi
-exec $(dirname $0)/kafka-run-class.sh org.apache.kafka.connect.cli.ConnectStandalone "$@"
+EXTRA_ARGS=${EXTRA_ARGS-'-name connectStandalone'}
+
+COMMAND=$1
+case $COMMAND in
+ -daemon)
+ EXTRA_ARGS="-daemon "$EXTRA_ARGS
+ shift
+ ;;
+ *)
+ ;;
+esac
+
+exec $(dirname $0)/kafka-run-class.sh $EXTRA_ARGS org.apache.kafka.connect.cli.ConnectStandalone "$@"