@cryptotaxi247 / netdata-1 / commits / b954f869f

install init.d script on AMI; add netdata to nginx group to let access nginx logs

Costa Tsaousis (ktsaou) committed Dec 23, 2016 at 22:42 UTC b954f869fa6e34cef29ff1862f0ac3b0753c417d
1 file changed +14 -3
netdata-installer.sh
+14 -3
@@ -624,12 +624,12 @@ portable_add_user_to_group() {
624 getent group "${groupname}" > /dev/null 2>&1
625 [ $? -ne 0 ] && return 1
626
627 - # find the users in the docker group
627 + # find the user is already in the group
628 local users=$(getent group "${groupname}" | cut -d ':' -f 4)
629 if [[ ",${users}," =~ ,${username}, ]]
630 then
631 # username is already there
632 - :
632 + return 0
633 else
634 # username is not in group
635 echo >&2 "Adding ${username} user to the ${groupname} group ..."
@@ -660,11 +660,13 @@ portable_add_user_to_group() {
660 run find ./system/ -type f -a \! -name \*.in -a \! -name Makefile\* -a \! -name \*.conf -a \! -name \*.service -exec chmod 755 {} \;
661
662 NETDATA_ADDED_TO_DOCKER=0
663 +NETDATA_ADDED_TO_NGINX=0
664 if [ ${UID} -eq 0 ]
665 then
666 portable_add_group netdata
667 portable_add_user netdata
668 portable_add_user_to_group docker netdata && NETDATA_ADDED_TO_DOCKER=1
669 + portable_add_user_to_group ngnix netdata && NETDATA_ADDED_TO_NGINX=1
670
671 if [ -d /etc/logrotate.d -a ! -f /etc/logrotate.d/netdata ]
672 then
@@ -965,7 +967,7 @@ install_non_systemd_init() {
967 run update-rc.d netdata enable && \
968 installed_init_d=1
969
968 - elif [ "${key}" = "CentOS release 6.8 (Final)" ]
970 + elif [ "${key}" = "CentOS release 6.8 (Final)" -o "${key}" = "amzn-2016.09" ]
971 then
972 run cp system/netdata-init-d /etc/init.d/netdata && \
973 run chmod 755 /etc/init.d/netdata && \
@@ -1276,6 +1278,15 @@ if [ $? -eq 0 -a "${NETDATA_ADDED_TO_DOCKER}" = "1" ]
1278 echo " gpasswd -d netdata docker"
1279 fi
1280
1281 +getent group nginx > /dev/null
1282 +if [ $? -eq 0 -a "${NETDATA_ADDED_TO_NGINX}" = "1" ]
1283 + then
1284 + echo
1285 + echo "You may also want to remove the netdata user from the nginx group"
1286 + echo "by running:"
1287 + echo " gpasswd -d netdata nginx"
1288 +fi
1289 +
1290 UNINSTALL
1291 chmod 750 netdata-uninstaller.sh
1292