mirror of https://github.com/apache/druid.git
* Add CTA and fix typo * resolve hostname better
This commit is contained in:
parent
ff24901fda
commit
d9607a667b
|
@ -25,5 +25,5 @@ README
|
|||
.pmdruleset.xml
|
||||
.java-version
|
||||
integration-tests/gen-scripts/
|
||||
bin/
|
||||
/bin/
|
||||
*.hprof
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
# 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
|
||||
#
|
||||
# http://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.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Sys::Hostname qw/hostname/;
|
||||
|
||||
my $h = hostname;
|
||||
system("host \Q$h\E >/dev/null 2>&1");
|
||||
my $h_valid = !$?;
|
||||
|
||||
print "Starting Apache Druid.\n";
|
||||
print "Open http://localhost:8888/" .
|
||||
($h_valid ? " or http://$h:8888/" : "") .
|
||||
" in your browser to access the web console.\n";
|
||||
print "Or, if you have enabled TLS, use https on port 9088.\n"
|
|
@ -55,12 +55,13 @@ sub read_config_file
|
|||
|
||||
my @commands;
|
||||
my @verify;
|
||||
my @notify;
|
||||
my $kill_timeout;
|
||||
while (my $line = <$config_fh>) {
|
||||
chomp $line;
|
||||
next if $line =~ /^(\s*\#.*|\s*)$/;
|
||||
|
||||
if ($line =~ /^(:verify|:kill-timeout|(?:\!p[0-9]+\s+)?[^:]\S+)\s+(.+)$/) {
|
||||
if ($line =~ /^(:verify|:notify|:kill-timeout|(?:\!p[0-9]+\s+)?[^:]\S+)\s+(.+)$/) {
|
||||
my $name = $1;
|
||||
my $order = 50;
|
||||
my $command = $2;
|
||||
|
@ -72,6 +73,8 @@ sub read_config_file
|
|||
|
||||
if ($name eq ':verify') {
|
||||
push @verify, $command;
|
||||
} elsif ($name eq ':notify') {
|
||||
push @notify, $command;
|
||||
} elsif ($name eq ':kill-timeout') {
|
||||
$kill_timeout = int($command);
|
||||
} else {
|
||||
|
@ -92,7 +95,7 @@ sub read_config_file
|
|||
}
|
||||
|
||||
close $config_fh;
|
||||
return { commands => \@commands, verify => \@verify, 'kill-timeout' => $kill_timeout };
|
||||
return { commands => \@commands, verify => \@verify, notify => \@notify, 'kill-timeout' => $kill_timeout };
|
||||
}
|
||||
|
||||
sub stringify_exit_status
|
||||
|
@ -136,6 +139,8 @@ sub pretty
|
|||
return "\x1b[1m$text\x1b[0m";
|
||||
} elsif ($color eq 'red') {
|
||||
return "\x1b[31m\x1b[1m$text\x1b[0m";
|
||||
} elsif ($color eq 'green') {
|
||||
return "\x1b[32m\x1b[1m$text\x1b[0m";
|
||||
} else {
|
||||
return $text;
|
||||
}
|
||||
|
@ -236,8 +241,18 @@ $SIG{TERM} = sub { if (!$killed) { $killed = 15; $killkill = time + $opt{'kill-t
|
|||
# Build up control fifo command over multiple sysreads, potentially
|
||||
my $fifobuffer = '';
|
||||
|
||||
# Run notification commands and print their output
|
||||
for my $notify_cmd (@{$config->{notify}}) {
|
||||
my $notify_output = qx[$notify_cmd 2>&1];
|
||||
if (!$?) {
|
||||
for my $notify_line (split /\n/, $notify_output) {
|
||||
logit pretty($notify_line, 'green');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (defined $opt{svlogd}) {
|
||||
logit "Staring services with log directory [svdir].";
|
||||
logit "Starting services with log directory [$svdir].";
|
||||
} else {
|
||||
logit "Starting services with log directory [$logdir].";
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
:verify bin/verify-java
|
||||
:verify bin/verify-default-ports
|
||||
:notify bin/greet
|
||||
:kill-timeout 10
|
||||
|
||||
!p10 zk bin/run-zk conf
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
:verify bin/verify-java
|
||||
:verify bin/verify-default-ports
|
||||
:notify bin/greet
|
||||
:kill-timeout 10
|
||||
|
||||
!p10 zk bin/run-zk conf
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
:verify bin/verify-java
|
||||
:verify bin/verify-default-ports
|
||||
:notify bin/greet
|
||||
:kill-timeout 10
|
||||
|
||||
!p10 zk bin/run-zk conf
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
:verify bin/verify-java
|
||||
:verify bin/verify-default-ports
|
||||
:notify bin/greet
|
||||
:kill-timeout 10
|
||||
|
||||
!p10 zk bin/run-zk conf
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
:verify bin/verify-java
|
||||
:verify bin/verify-default-ports
|
||||
:notify bin/greet
|
||||
:kill-timeout 10
|
||||
|
||||
!p10 zk bin/run-zk conf
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
:verify bin/verify-java
|
||||
:verify bin/verify-default-ports
|
||||
:notify bin/greet
|
||||
:kill-timeout 10
|
||||
|
||||
!p10 zk bin/run-zk conf
|
||||
|
|
Loading…
Reference in New Issue