Skip to content

Commit

Permalink
Add --daemon option to start script (apache#642)
Browse files Browse the repository at this point in the history
Add --daemon option to start_fe.sh/start_be.sh/start_broker.sh
If run scripte without --daemon, it will run as a foreground process.
  • Loading branch information
morningman authored and lide-reed committed Feb 22, 2019
1 parent fa82740 commit 7dbfc10
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 3 deletions.
23 changes: 22 additions & 1 deletion bin/start_be.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@
curdir=`dirname "$0"`
curdir=`cd "$curdir"; pwd`

OPTS=$(getopt \
-n $0 \
-o '' \
-l 'daemon' \
-- "$@")

eval set -- "$OPTS"

RUN_DAEMON=0
while true; do
case "$1" in
--daemon) RUN_DAEMON=1 ; shift ;;
--) shift ; break ;;
*) ehco "Internal error" ; exit 1 ;;
esac
done

export DORIS_HOME=`cd "$curdir/.."; pwd`

# export env variables from be.conf
Expand Down Expand Up @@ -72,4 +89,8 @@ else
LIMIT="/bin/limit3 -c 0 -n 65536"
fi

nohup $LIMIT ${DORIS_HOME}/lib/palo_be "$@" >> $LOG_DIR/be.out 2>&1 </dev/null &
if [ ${RUN_DAEMON} -eq 1 ]; then
nohup $LIMIT ${DORIS_HOME}/lib/palo_be "$@" >> $LOG_DIR/be.out 2>&1 </dev/null &
else
$LIMIT ${DORIS_HOME}/lib/palo_be "$@" >> $LOG_DIR/be.out 2>&1 </dev/null
fi
32 changes: 31 additions & 1 deletion bin/start_fe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@
curdir=`dirname "$0"`
curdir=`cd "$curdir"; pwd`

OPTS=$(getopt \
-n $0 \
-o '' \
-l 'daemon' \
-l 'helper:' \
-- "$@")

eval set -- "$OPTS"

RUN_DAEMON=0
HELPER=
while true; do
case "$1" in
--daemon) RUN_DAEMON=1 ; shift ;;
--helper) HELPER=$2 ; shift 2 ;;
--) shift ; break ;;
*) ehco "Internal error" ; exit 1 ;;
esac
done

export DORIS_HOME=`cd "$curdir/.."; pwd`

# export env variables from fe.conf
Expand Down Expand Up @@ -75,6 +95,16 @@ else
fi

echo `date` >> $LOG_DIR/fe.out
nohup $LIMIT $JAVA $JAVA_OPTS org.apache.doris.PaloFe "$@" >> $LOG_DIR/fe.out 2>&1 </dev/null &

if [ x"$HELPER" != x"" ]; then
# change it to '-helper' to be compatible with code in Frontend
HELPER="-helper $HELPER"
fi

if [ ${RUN_DAEMON} -eq 1 ]; then
nohup $LIMIT $JAVA $JAVA_OPTS org.apache.doris.PaloFe ${HELPER} "$@" >> $LOG_DIR/fe.out 2>&1 </dev/null &
else
$LIMIT $JAVA $JAVA_OPTS org.apache.doris.PaloFe ${HELPER} "$@" >> $LOG_DIR/fe.out 2>&1 </dev/null
fi

echo $! > $pidfile
24 changes: 23 additions & 1 deletion fs_brokers/apache_hdfs_broker/bin/start_broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@
curdir=`dirname "$0"`
curdir=`cd "$curdir"; pwd`

OPTS=$(getopt \
-n $0 \
-o '' \
-l 'daemon' \
-- "$@")

eval set -- "$OPTS"

RUN_DAEMON=0
while true; do
case "$1" in
--daemon) RUN_DAEMON=1 ; shift ;;
--) shift ; break ;;
*) ehco "Internal error" ; exit 1 ;;
esac
done

export BROKER_HOME=`cd "$curdir/.."; pwd`
export PID_DIR=`cd "$curdir"; pwd`

Expand Down Expand Up @@ -61,6 +78,11 @@ if [ ! -d $BROKER_LOG_DIR ]; then
fi

echo `date` >> $BROKER_LOG_DIR/apache_hdfs_broker.out
nohup $LIMIT $JAVA $JAVA_OPTS org.apache.doris.broker.hdfs.BrokerBootstrap "$@" >> $BROKER_LOG_DIR/apache_hdfs_broker.out 2>&1 </dev/null &

if [ ${RUN_DAEMON} -eq 1 ]; then
nohup $LIMIT $JAVA $JAVA_OPTS org.apache.doris.broker.hdfs.BrokerBootstrap "$@" >> $BROKER_LOG_DIR/apache_hdfs_broker.out 2>&1 </dev/null &
else
$LIMIT $JAVA $JAVA_OPTS org.apache.doris.broker.hdfs.BrokerBootstrap "$@" >> $BROKER_LOG_DIR/apache_hdfs_broker.out 2>&1 </dev/null
fi

echo $! > $pidfile

0 comments on commit 7dbfc10

Please sign in to comment.