Allowed passing in of local conf file to ramcloud scripts

Change-Id: I267fe5c8caf0bfb9e36e7ef127a52018e77e314a
diff --git a/start-ramcloud-coordinator.sh b/start-ramcloud-coordinator.sh
index 1c0d9a7..d23c301 100755
--- a/start-ramcloud-coordinator.sh
+++ b/start-ramcloud-coordinator.sh
@@ -11,9 +11,15 @@
 RAMCLOUD_DIR=${HOME}/ramcloud
 LOGDIR=${ONOS_LOGDIR:-${ONOS_HOME}/onos-logs}
 RAMCLOUD_LOG=${LOGDIR}/ramcloud.coordinator.`hostname`.log
-coordinatorip=`grep coordinatorIp ${ONOS_HOME}/conf/ramcloud.conf | cut -d "=" -f 2,3`
-coordinatorport=`grep coordinatorPort ${ONOS_HOME}/conf/ramcloud.conf | cut -d "=" -f 2,3`
-RAMCLOUD_COORDINATOR=`echo $coordinatorip","$coordinatorport`
+RAMCLOUD_CONF=${RAMCLOUD_CONF:-${ONOS_HOME}/conf/ramcloud.conf}
+#coordinatorip=`grep coordinatorIp ${ONOS_HOME}/conf/ramcloud.conf | cut -d "=" -f 2,3`
+#coordinatorport=`grep coordinatorPort ${ONOS_HOME}/conf/ramcloud.conf | cut -d "=" -f 2,3`
+
+COORDINATOR_IP=`grep coordinatorIp ${RAMCLOUD_CONF} | cut -d "=" -f 2,3`
+COORDINATOR_PORT=`grep coordinatorPort ${RAMCLOUD_CONF} | cut -d "=" -f 2,3`
+
+#RAMCLOUD_COORDINATOR=`echo $coordinatorip","$coordinatorport`
+RAMCLOUD_COORDINATOR=`echo $COORDINATOR_IP","$COORDINATOR_PORT`
 RAMCLOUD_BRANCH=${RAMCLOUD_BRANCH:-master}
 
 function lotate {
@@ -50,32 +56,20 @@
   for p in ${pids}; do
     if [ x$p != "x" ]; then
       kill -KILL $p
-      echo "Killed existing prosess (pid: $p)"
+      echo "Killed existing process (pid: $p)"
     fi
   done
 }
 
-function deldb {
-#   # Delete the berkeley db database
-   if [ -d "/tmp/ramcloud.conf" ]; then
-      echo "deleting berkeley db dir"
-      sudo rm -rf /tmp/ramcloud.conf
-   fi
-}
-
 case "$1" in
   start)
-    deldb
-    cp $ONOS_HOME/conf/ramcloud.conf /tmp
+    #cp $ONOS_HOME/conf/ramcloud.conf /tmp
     stop
     start 
     ;;
   stop)
     stop
     ;;
-#  deldb)
-#    deldb
-#    ;;
   status)
     n=`pgrep -f obj.${RAMCLOUD_BRANCH}/coordinator | wc -l`
     echo "$n ramcloud coordinator is running"
diff --git a/start-ramcloud-server.sh b/start-ramcloud-server.sh
index c938f14..395a234 100755
--- a/start-ramcloud-server.sh
+++ b/start-ramcloud-server.sh
@@ -13,12 +13,23 @@
 RAMCLOUD_DIR=${HOME}/ramcloud
 LOGDIR=${ONOS_LOGDIR:-${ONOS_HOME}/onos-logs}
 RAMCLOUD_LOG=${LOGDIR}/ramcloud.server.`hostname`.log
-coordinatorip=`grep coordinatorIp ${ONOS_HOME}/conf/ramcloud.conf | cut -d "=" -f 2,3`
-coordinatorport=`grep coordinatorPort ${ONOS_HOME}/conf/ramcloud.conf | cut -d "=" -f 2,3`
-RAMCLOUD_COORDINATOR=`echo $coordinatorip","$coordinatorport`
-serverip=`grep serverIp ${ONOS_HOME}/conf/ramcloud.conf | cut -d "=" -f 2,3`
-serverport=`grep serverPort ${ONOS_HOME}/conf/ramcloud.conf | cut -d "=" -f 2,3`
-RAMCLOUD_SERVER=`echo $serverip","$serverport`
+RAMCLOUD_CONF=${RAMCLOUD_CONF:-${ONOS_HOME}/conf/ramcloud.conf}
+
+#coordinatorip=`grep coordinatorIp ${ONOS_HOME}/conf/ramcloud.conf | cut -d "=" -f 2,3`
+#coordinatorport=`grep coordinatorPort ${ONOS_HOME}/conf/ramcloud.conf | cut -d "=" -f 2,3`
+#RAMCLOUD_COORDINATOR=`echo $coordinatorip","$coordinatorport`
+COORDINATOR_IP=`grep coordinatorIp ${RAMCLOUD_CONF} | cut -d "=" -f 2,3`
+COORDINATOR_PORT=`grep coordinatorPort ${RAMCLOUD_CONF} | cut -d "=" -f 2,3`
+RAMCLOUD_COORDINATOR=`echo $COORDINATOR_IP","$COORDINATOR_PORT`
+
+#serverip=`grep serverIp ${ONOS_HOME}/conf/ramcloud.conf | cut -d "=" -f 2,3`
+#serverport=`grep serverPort ${ONOS_HOME}/conf/ramcloud.conf | cut -d "=" -f 2,3`
+#RAMCLOUD_SERVER=`echo $serverip","$serverport`
+
+SERVER_IP=`grep serverIp ${RAMCLOUD_CONF} | cut -d "=" -f 2,3`
+SERVER_PORT=`grep serverPort ${RAMCLOUD_CONF} | cut -d "=" -f 2,3`
+RAMCLOUD_SERVER=`echo $SERVER_IP","$SERVER_PORT`
+
 RAMCLOUD_BRANCH=${RAMCLOUD_BRANCH:-master}
 
 function lotate {
@@ -55,32 +66,20 @@
   for p in ${pids}; do
     if [ x$p != "x" ]; then
       kill -KILL $p
-      echo "Killed existing prosess (pid: $p)"
+      echo "Killed existing process (pid: $p)"
     fi
   done
 }
 
-function deldb {
-#   # Delete the berkeley db database
-   if [ -d "/tmp/ramcloud.conf" ]; then
-      echo "deleting berkeley db dir"
-      sudo rm -rf /tmp/ramcloud.conf
-   fi
-}
-
 case "$1" in
   start)
-    deldb
-    cp $ONOS_HOME/conf/ramcloud.conf /tmp
+    #cp $ONOS_HOME/conf/ramcloud.conf /tmp
     stop
     start 
     ;;
   stop)
     stop
     ;;
-#  deldb)
-#    deldb
-#    ;;
   status)
     n=`pgrep -f obj.${RAMCLOUD_BRANCH}/server | wc -l`
     echo "$n ramcloud server running"