ddanielr commented on code in PR #4763:
URL: https://github.com/apache/accumulo/pull/4763#discussion_r1694306132


##########
assemble/bin/accumulo-service:
##########
@@ -137,40 +192,61 @@ function main() {
   mkdir -p "$ACCUMULO_LOG_DIR" 2>/dev/null
   mkdir -p "$ACCUMULO_PID_DIR" 2>/dev/null
 
-  host="$(hostname)"
-  if [[ -z $host ]]; then
-    host=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut 
-f1 -d'/')
+  HOST="$(hostname)"
+  if [[ -z $HOST ]]; then
+    HOST=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut 
-f1 -d'/')
   fi
-  service="$1"
 
-  if [[ $service == "master" ]]; then
+  local service_type="$1"
+  local command_name="$2"
+  shift 2
+  local service_name="unknown"
+  local all_flag=false
+
+  if [[ $service_type == "master" ]]; then
     echo "WARN : Use of 'master' service name is deprecated; use 'manager' 
instead."
-    service="manager"
+    service_type="manager"
+  fi
+
+  # Check and see if accumulo-cluster is calling this script
+  if [ -z ${ACCUMULO_SERVICE_INSTANCE+x} ]; then
+    # The rest of the arguments are from a user
+    if [[ $1 == "--all" ]]; then
+      all_flag=true
+    else
+      # A named service has been specified
+      service_name="$1"
+    fi
+  # Use the special bash env var from accumulo-cluster
+  else
+    service_name=${service_type}${ACCUMULO_SERVICE_INSTANCE}
   fi
 
-  
pid_file="${ACCUMULO_PID_DIR}/accumulo-${service}${ACCUMULO_SERVICE_INSTANCE}.pid"
-  case "$service" in
+  case "$service_type" in
     gc | manager | monitor | tserver | compaction-coordinator | compactor | 
sserver)
-      if [[ -z $2 ]]; then
+      if [ -z ${command_name+z} ]; then

Review Comment:
   suggestion has been applied 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to