]> arthur.barton.de Git - netdata.git/commitdiff
install init.d script on AMI; add netdata to nginx group to let access nginx logs
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 23 Dec 2016 20:42:51 +0000 (22:42 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 23 Dec 2016 20:42:51 +0000 (22:42 +0200)
netdata-installer.sh

index 2c5a2479b49b381e2d4958f671c502a3592e00d3..90f0bab4745ce987ab38f4eb182f849bbafbcf1e 100755 (executable)
@@ -624,12 +624,12 @@ portable_add_user_to_group() {
     getent group "${groupname}" > /dev/null 2>&1
     [ $? -ne 0 ] && return 1
 
-    # find the users in the docker group
+    # find the user is already in the group
     local users=$(getent group "${groupname}" | cut -d ':' -f 4)
     if [[ ",${users}," =~ ,${username}, ]]
         then
         # username is already there
-        :
+        return 0
     else
         # username is not in group
         echo >&2 "Adding ${username} user to the ${groupname} group ..."
@@ -660,11 +660,13 @@ portable_add_user_to_group() {
 run find ./system/ -type f -a \! -name \*.in -a \! -name Makefile\* -a \! -name \*.conf  -a \! -name \*.service -exec chmod 755 {} \;
 
 NETDATA_ADDED_TO_DOCKER=0
+NETDATA_ADDED_TO_NGINX=0
 if [ ${UID} -eq 0 ]
     then
     portable_add_group netdata
     portable_add_user netdata
     portable_add_user_to_group docker netdata && NETDATA_ADDED_TO_DOCKER=1
+    portable_add_user_to_group ngnix  netdata && NETDATA_ADDED_TO_NGINX=1
 
     if [ -d /etc/logrotate.d -a ! -f /etc/logrotate.d/netdata ]
         then
@@ -965,7 +967,7 @@ install_non_systemd_init() {
             run update-rc.d netdata enable && \
             installed_init_d=1
 
-        elif [ "${key}" = "CentOS release 6.8 (Final)" ]
+        elif [ "${key}" = "CentOS release 6.8 (Final)" -o "${key}" = "amzn-2016.09" ]
             then
             run cp system/netdata-init-d /etc/init.d/netdata && \
             run chmod 755 /etc/init.d/netdata && \
@@ -1276,6 +1278,15 @@ if [ $? -eq 0 -a "${NETDATA_ADDED_TO_DOCKER}" = "1" ]
     echo "   gpasswd -d netdata docker"
 fi
 
+getent group nginx > /dev/null
+if [ $? -eq 0 -a "${NETDATA_ADDED_TO_NGINX}" = "1" ]
+    then
+    echo
+    echo "You may also want to remove the netdata user from the nginx group"
+    echo "by running:"
+    echo "   gpasswd -d netdata nginx"
+fi
+
 UNINSTALL
 chmod 750 netdata-uninstaller.sh