Skip to content

Commit

Permalink
modify start and stop script. User can now specified PID file dir and…
Browse files Browse the repository at this point in the history
… log dir (apache#71)
  • Loading branch information
morningman authored and yubingpeng committed Sep 4, 2017
1 parent 81c860d commit fde6b39
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 20 deletions.
10 changes: 5 additions & 5 deletions be/src/agent/agent_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ AgentServer::AgentServer(ExecEnv* exec_env,
}

// create tmp dir
boost::filesystem::path tmp_path(config::agent_tmp_dir);
if (boost::filesystem::exists(tmp_path)) {
boost::filesystem::remove_all(tmp_path);
}
boost::filesystem::create_directories(config::agent_tmp_dir);
// boost::filesystem::path tmp_path(config::agent_tmp_dir);
// if (boost::filesystem::exists(tmp_path)) {
// boost::filesystem::remove_all(tmp_path);
// }
// boost::filesystem::create_directories(config::agent_tmp_dir);

// init task worker pool
_create_table_workers = new TaskWorkerPool(
Expand Down
2 changes: 1 addition & 1 deletion be/src/olap/olap_rootpath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ OLAPStatus OLAPRootPath::init() {
return OLAP_ERR_MALLOC_ERROR;
}

_unused_flag_path = string(getenv("PALO_HOME")) + UNUSED_PREFIX;
_unused_flag_path = string(getenv("LOG_DIR")) + UNUSED_PREFIX;
if (!check_dir_existed(_unused_flag_path)) {
if ((res = create_dir(_unused_flag_path)) != OLAP_SUCCESS) {
OLAP_LOG_WARNING("fail to create unused flag path.[path='%s']",
Expand Down
2 changes: 1 addition & 1 deletion be/src/runtime/tmp_file_mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ TmpFileMgr::TmpFileMgr() :
_num_active_scratch_dirs_metric(NULL), _active_scratch_dirs_metric(NULL) {}

Status TmpFileMgr::init(MetricGroup* metrics) {
std::string tmp_dirs_spec = config::query_scratch_dirs;
std::string tmp_dirs_spec = config::storage_root_path;
vector<string> all_tmp_dirs;
// Empty string should be interpreted as no scratch
if (!tmp_dirs_spec.empty()) {
Expand Down
2 changes: 1 addition & 1 deletion be/src/service/palo_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int main(int argc, char** argv) {
using std::string;

// open pid file, obtain file lock and save pid
string pid_file = string(getenv("PALO_HOME")) + "/bin/be.pid";
string pid_file = string(getenv("PID_DIR")) + "/be.pid";
int fd = open(pid_file.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
if (fd < 0) {
fprintf(stderr, "fail to create pid file.");
Expand Down
14 changes: 11 additions & 3 deletions bin/start_be.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export PALO_HOME=`cd "$curdir/.."; pwd`
#
# UDF_RUNTIME_DIR
# LOG_DIR
# PID_DIR
export UDF_RUNTIME_DIR=${PALO_HOME}/lib/udf-runtime
export LOG_DIR=${PALO_HOME}/log
export PID_DIR=`cd "$curdir"; pwd`

while read line; do
envline=`echo $line | sed 's/[[:blank:]]*=[[:blank:]]*/=/g' | sed 's/^[[:blank:]]*//g' | egrep "^[[:upper:]]([[:upper:]]|_|[[:digit:]])*="`
Expand All @@ -35,11 +37,17 @@ while read line; do
fi
done < $PALO_HOME/conf/be.conf

mkdir -p $LOG_DIR
mkdir -p ${UDF_RUNTIME_DIR}
if [ ! -d $LOG_DIR ]; then
mkdir -p $LOG_DIR
fi

if [ ! -d $UDF_RUNTIME_DIR ]; then
mkdir -p ${UDF_RUNTIME_DIR}
fi

rm -f ${UDF_RUNTIME_DIR}/*

pidfile=$curdir/be.pid
pidfile=$PID_DIR/be.pid

if [ -f $pidfile ]; then
if flock -nx $pidfile -c "ls > /dev/null 2>&1"; then
Expand Down
9 changes: 6 additions & 3 deletions bin/start_fe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export PALO_HOME=`cd "$curdir/.."; pwd`
#
# JAVA_OPTS
# LOG_DIR
# PID_DIR
export JAVA_OPTS="-Xmx1024m"
export LOG_DIR="$PALO_HOME/log"
export PID_DIR=`cd "$curdir"; pwd`

while read line; do
envline=`echo $line | sed 's/[[:blank:]]*=[[:blank:]]*/=/g' | sed 's/^[[:blank:]]*//g' | egrep "^[[:upper:]]([[:upper:]]|_|[[:digit:]])*="`
Expand All @@ -52,10 +54,11 @@ for f in $PALO_HOME/lib/kudu-client/*.jar; do
done
export CLASSPATH=${CLASSPATH}:${PALO_HOME}/lib

if [ ! -d $LOG_DIR ]; then
mkdir -p $LOG_DIR
fi

mkdir -p $LOG_DIR

pidfile=$curdir/fe.pid
pidfile=$PID_DIR/fe.pid

if [ -f $pidfile ]; then
if kill -0 `cat $pidfile` > /dev/null 2>&1; then
Expand Down
13 changes: 12 additions & 1 deletion bin/stop_be.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@
curdir=`dirname "$0"`
curdir=`cd "$curdir"; pwd`

pidfile=$curdir/be.pid
export PALO_HOME=`cd "$curdir/.."; pwd`
export PID_DIR=`cd "$curdir"; pwd`

while read line; do
envline=`echo $line | sed 's/[[:blank:]]*=[[:blank:]]*/=/g' | sed 's/^[[:blank:]]*//g' | egrep "^[[:upper:]]([[:upper:]]|_|[[:digit:]])*="`
envline=`eval "echo $envline"`
if [[ $envline == *"="* ]]; then
eval 'export "$envline"'
fi
done < $PALO_HOME/conf/be.conf

pidfile=$PID_DIR/be.pid

if [ -f $pidfile ]; then
pid=`cat $pidfile`
Expand Down
13 changes: 12 additions & 1 deletion bin/stop_fe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@
curdir=`dirname "$0"`
curdir=`cd "$curdir"; pwd`

pidfile=$curdir/fe.pid
export PALO_HOME=`cd "$curdir/.."; pwd`
export PID_DIR=`cd "$curdir"; pwd`

while read line; do
envline=`echo $line | sed 's/[[:blank:]]*=[[:blank:]]*/=/g' | sed 's/^[[:blank:]]*//g' | egrep "^[[:upper:]]([[:upper:]]|_|[[:digit:]])*="`
envline=`eval "echo $envline"`
if [[ $envline == *"="* ]]; then
eval 'export "$envline"'
fi
done < $PALO_HOME/conf/fe.conf

pidfile=$PID_DIR/fe.pid

if [ -f $pidfile ]; then
pid=`cat $pidfile`
Expand Down
11 changes: 10 additions & 1 deletion fs_brokers/apache_hdfs_broker/bin/start_hdfs_broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ curdir=`dirname "$0"`
curdir=`cd "$curdir"; pwd`

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

#
# JAVA_OPTS
Expand All @@ -40,7 +41,15 @@ for f in $BROKER_HOME/lib/*.jar; do
done
export CLASSPATH=${CLASSPATH}:${BROKER_HOME}/lib

pidfile=$curdir/apache_hdfs_broker.pid
while read line; do
envline=`echo $line | sed 's/[[:blank:]]*=[[:blank:]]*/=/g' | sed 's/^[[:blank:]]*//g' | egrep "^[[:upper:]]([[:upper:]]|_|[[:digit:]])*="`
envline=`eval "echo $envline"`
if [[ $envline == *"="* ]]; then
eval 'export "$envline"'
fi
done < $BROKER_HOME/conf/apache_hdfs_broker.conf

pidfile=$PID_DIR/apache_hdfs_broker.pid

if [ -f $pidfile ]; then
if kill -0 `cat $pidfile` > /dev/null 2>&1; then
Expand Down
13 changes: 12 additions & 1 deletion fs_brokers/apache_hdfs_broker/bin/stop_hdfs_broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@
curdir=`dirname "$0"`
curdir=`cd "$curdir"; pwd`

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

while read line; do
envline=`echo $line | sed 's/[[:blank:]]*=[[:blank:]]*/=/g' | sed 's/^[[:blank:]]*//g' | egrep "^[[:upper:]]([[:upper:]]|_|[[:digit:]])*="`
envline=`eval "echo $envline"`
if [[ $envline == *"="* ]]; then
eval 'export "$envline"'
fi
done < $BROKER_HOME/conf/apache_hdfs_broker.conf

pidfile=$PID_DIR/apache_hdfs_broker.pid

if [ -f $pidfile ]; then
pid=`cat $pidfile`
Expand Down
11 changes: 10 additions & 1 deletion fs_brokers/baidu_bos_broker/bin/start_bos_broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ curdir=`dirname "$0"`
curdir=`cd "$curdir"; pwd`

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

#
# JAVA_OPTS
Expand All @@ -40,7 +41,15 @@ for f in $BROKER_HOME/lib/*.jar; do
done
export CLASSPATH=${CLASSPATH}:${BROKER_HOME}/lib

pidfile=$curdir/bos_broker.pid
while read line; do
envline=`echo $line | sed 's/[[:blank:]]*=[[:blank:]]*/=/g' | sed 's/^[[:blank:]]*//g' | egrep "^[[:upper:]]([[:upper:]]|_|[[:digit:]])*="`
envline=`eval "echo $envline"`
if [[ $envline == *"="* ]]; then
eval 'export "$envline"'
fi
done < $BROKER_HOME/conf/baidu_bos_broker.conf

pidfile=$PID_DIR/bos_broker.pid

if [ -f $pidfile ]; then
if kill -0 `cat $pidfile` > /dev/null 2>&1; then
Expand Down
13 changes: 12 additions & 1 deletion fs_brokers/baidu_bos_broker/bin/stop_bos_broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@
curdir=`dirname "$0"`
curdir=`cd "$curdir"; pwd`

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

while read line; do
envline=`echo $line | sed 's/[[:blank:]]*=[[:blank:]]*/=/g' | sed 's/^[[:blank:]]*//g' | egrep "^[[:upper:]]([[:upper:]]|_|[[:digit:]])*="`
envline=`eval "echo $envline"`
if [[ $envline == *"="* ]]; then
eval 'export "$envline"'
fi
done < $BROKER_HOME/conf/baidu_bos_broker.conf

pidfile=$PID_DIR/bos_broker.pid

if [ -f $pidfile ]; then
pid=`cat $pidfile`
Expand Down

0 comments on commit fde6b39

Please sign in to comment.