Druid launch script improvements (#3175)

* Add status command to launch scripts

* make druid init script to pick up config directories from environment variables

make druid init script to pick up config directories from environment
variables
This commit is contained in:
Nishant 2016-06-24 15:02:34 -07:00 committed by Gian Merlino
parent 8a08398977
commit 94b3c74cdc
6 changed files with 36 additions and 12 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash -eu
usage="Usage: broker.sh (start|stop)"
usage="Usage: broker.sh (start|stop|status)"
if [ $# -lt 1 ]; then
echo $usage

View File

@ -1,6 +1,6 @@
#!/bin/bash -eu
usage="Usage: coordinator.sh (start|stop)"
usage="Usage: coordinator.sh (start|stop|status)"
if [ $# -lt 1 ]; then
echo $usage

View File

@ -1,6 +1,6 @@
#!/bin/bash -eu
usage="Usage: historical.sh (start|stop)"
usage="Usage: historical.sh (start|stop|status)"
if [ $# -lt 1 ]; then
echo $usage

View File

@ -1,6 +1,6 @@
#!/bin/bash -eu
usage="Usage: middleManager.sh (start|stop)"
usage="Usage: middleManager.sh (start|stop|status)"
if [ $# -lt 1 ]; then
echo $usage

View File

@ -1,9 +1,14 @@
#!/bin/bash -eu
## Initializtion script for druid nodes
## Runs druid nodes as a daemon and pipes logs to log/ directory
## Initialization script for druid nodes
## Runs druid nodes as a daemon
## Environment Variables used by this script -
## DRUID_LIB_DIR - directory having druid jar files, default=lib
## DRUID_CONF_DIR - directory having druid config files, default=conf/druid
## DRUID_LOG_DIR - directory used to store druid logs, default=log
## DRUID_PID_DIR - directory used to store pid files, default=var/druid/pids
usage="Usage: node.sh nodeType (start|stop)"
usage="Usage: node.sh nodeType (start|stop|status)"
if [ $# -le 1 ]; then
echo $usage
@ -13,10 +18,16 @@ fi
nodeType=$1
shift
startStop=$1
pid=var/druid/pids/$nodeType.pid
command=$1
case $startStop in
LIB_DIR="${DRUID_LIB_DIR:=lib}"
CONF_DIR="${DRUID_CONF_DIR:=conf/druid}"
LOG_DIR="${DRUID_LOG_DIR:=log}"
PID_DIR="${DRUID_PID_DIR:=var/druid/pids}"
pid=$PID_DIR/$nodeType.pid
case $command in
(start)
@ -27,7 +38,7 @@ case $startStop in
fi
fi
nohup java `cat conf/druid/$nodeType/jvm.config | xargs` -cp conf/druid/_common:conf/druid/$nodeType:lib/* io.druid.cli.Main server $nodeType > log/$nodeType.log &
nohup java `cat $CONF_DIR/$nodeType/jvm.config | xargs` -cp $CONF_DIR/_common:$CONF_DIR/$nodeType:$LIB_DIR/* io.druid.cli.Main server $nodeType > $LOG_DIR/$nodeType.log &
nodeType_PID=$!
echo $nodeType_PID > $pid
echo "Started $nodeType node ($nodeType_PID)"
@ -49,6 +60,19 @@ case $startStop in
fi
;;
(status)
if [ -f $pid ]; then
if kill -0 `cat $pid` > /dev/null 2>&1; then
echo RUNNING
exit 0
else
echo STOPPED
fi
else
echo STOPPED
fi
;;
(*)
echo $usage
exit 1

View File

@ -1,6 +1,6 @@
#!/bin/bash -eu
usage="Usage: overlord.sh (start|stop)"
usage="Usage: overlord.sh (start|stop|status)"
if [ $# -lt 1 ]; then
echo $usage