Browse Source

Merge pull request #10192 from mckellyln/hpcc-17907

HPCC-17907 Hpcc-init asking for password when starting Thor

Reviewed-By: Michael Gardner <michael.gardner@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 years ago
parent
commit
450a81e0f3

+ 2 - 2
initfiles/bash/etc/init.d/dafilesrv.in

@@ -85,13 +85,13 @@ which_service
 #Check for existance of user
 check_user ${user}
 if [ $? -ne 1 ];then
-   echo "$user user does not exits on the system. Exiting ....."
+   echo "User ${user} does not exist on the system. Exiting ..."
    exit 3
 fi
 
 check_group ${group}
 if [ $? -ne 1 ];then
-   echo "Group for user ${user} does not exist on the system. Exiting....."
+   echo "Group ${group} does not exist on the system or not able to chgrp (sudo?). Exiting ..."
    exit 3
 fi
 

+ 4 - 4
initfiles/bash/etc/init.d/hpcc-init.in

@@ -131,15 +131,15 @@ log "--------------------------"
 #Check for existance of user
 check_user ${user}
 if [ $? -ne 1 ];then
-   log  "$user user does not exist on the system. Exiting ..."
-   echo "$user user does not exits on the system. Exiting ..."
+   log  "User ${user} does not exist on the system. Exiting ..."
+   echo "User ${user} does not exist on the system. Exiting ..."
    exit 3
 fi
 
 check_group ${group}
 if [ $? -ne 1 ];then
-   log  "Group for user ${group} does not exist on the system. Exiting ..."
-   echo "Group for user ${group} does not exist on the system. Exiting ..."
+   log  "Group ${group} does not exist on the system or not able to chgrp (sudo?). Exiting ..."
+   echo "Group ${group} does not exist on the system or not able to chgrp (sudo?). Exiting ..."
    exit 3
 fi
 

+ 1 - 0
initfiles/bash/etc/init.d/hpcc_common.in

@@ -724,6 +724,7 @@ check_user(){
 
 check_group(){
     GROUP=$1
+    # NOTE: this fails if we do not have rights to chgrp ...
     touch /tmp/file.$$
     chgrp ${GROUP} /tmp/file.$$ > /dev/null 2>&1
     if [ $(stat -c %G /tmp/file.$$ 2>/dev/null || stat -f %Sg /tmp/file.$$ 2>/dev/null) = "${GROUP}" ];

+ 4 - 1
initfiles/bin/init_thorslave.in

@@ -65,7 +65,10 @@ start_slaves()
 {
     # insuring dafilesrv is running on the machine as it is a prerequisite
     dafilesrv_owner=$(stat -c "%U" ${INIT_PATH}/dafilesrv 2>/dev/null || stat -f %Su ${INIT_PATH}/dafilesrv 2>/dev/null)
-    [[ "${dafilesrv_owner}" != "${user}" ]] && cmd_prefix="sudo"
+    # use full path as with CentOS devtoolset another sudo is found in path
+    # which does not work properly with changes in sudoers.d hpcc file
+    [[ "${dafilesrv_owner}" != "${user}" ]] && cmd_prefix="/usr/bin/sudo"
+    # is sudo required for checking status ?
     ${cmd_prefix} ${INIT_PATH}/dafilesrv status > /dev/null
     if [[ $? -ne 0 ]];then
         ${cmd_prefix} ${INIT_PATH}/dafilesrv start > /dev/null