HCATALOG-604 add flexibility wrt. location of PID/LOG files

git-svn-id: https://svn.apache.org/repos/asf/incubator/hcatalog/trunk@1438663 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index cdc31d9..0f71698 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -59,6 +59,8 @@
   HCAT-427 Document storage-based authorization (lefty via gates)
 
   IMPROVEMENTS
+  HCAT-604 add flexibility wrt. location of PID/LOG files (rvs via traviscrawford)
+
   HCAT-602 release notes for hcatalog 0.0.5 (traviscrawford)
 
   HCAT-595 Update hcatalog hive dependency to 0.10.0 (traviscrawford)
diff --git a/bin/hcat_server.sh b/bin/hcat_server.sh
index 357fff6..bf3c3f1 100644
--- a/bin/hcat_server.sh
+++ b/bin/hcat_server.sh
@@ -21,7 +21,8 @@
 bin=`dirname ${bin}`
 bin=`cd "$bin"; pwd`
 
-HCAT_LOG_DIR="$bin"/../var/log
+HCAT_LOG_DIR=${HCAT_LOG_DIR:-"$bin"/../var/log}
+HCAT_PID_DIR=${HCAT_PID_DIR:-$HCAT_LOG_DIR}
 
 if [ -e "$bin/../libexec/hcat-config.sh" ]; then
   . "$bin"/../libexec/hcat-config.sh
@@ -37,7 +38,7 @@
 
 function start_hcat() {
   # back ground the metastore service and record the pid
-  PID_FILE=${HCAT_LOG_DIR}/hcat.pid
+  PID_FILE=${HCAT_PID_DIR}/hcat.pid
   SLEEP_TIME_AFTER_START=15
 
   # check if service is already running, if so exit
@@ -112,7 +113,7 @@
 function stop_hcat() {
   SLEEP_TIME_AFTER_KILL=30
 
-  PID_FILE=${HCAT_LOG_DIR}/hcat.pid
+  PID_FILE=${HCAT_PID_DIR}/hcat.pid
   echo looking for $PID_FILE
 
   # check if service is already running, if so exit
diff --git a/webhcat/svr/src/main/bin/webhcat_config.sh b/webhcat/svr/src/main/bin/webhcat_config.sh
index fd9de7c..4cfdbb1 100644
--- a/webhcat/svr/src/main/bin/webhcat_config.sh
+++ b/webhcat/svr/src/main/bin/webhcat_config.sh
@@ -26,8 +26,6 @@
 PID_DIR=${WEBHCAT_PID_DIR:-.}
 PID_FILE=${PID_DIR}/webhcat.pid
 
-PID_FILE=./webhcat.pid
-
 #default log directory
 WEBHCAT_LOG_DIR=${WEBHCAT_LOG_DIR:-.}