From 27db0d4b249c10922360759c0da4c394efc1bc07 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 7 Apr 2020 17:20:34 -0500 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 20f257ed..8f953237 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -1126,29 +1126,26 @@ SET-PERMISSIONS(){ nid=`expr $nid + 1` done elif [ "${1}" = "nextcloud" ]; then - nid=1 - for nip in "${NC_HOSTS[@]}"; do - if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then - NCMD='' - else - NCMD="ssh root@${nip}" - fi + nip=${NC_HOSTS[0]} + if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then + NCMD='' + else + NCMD="ssh root@${nip}" + fi + if [ "${2}" != "q" ]; then + echo -en "${idsCL[Yellow]}Resetting folder permissions for Nextcloud on Nextcloud-Node1 (${nip})... ${idsCL[Default]}" + fi + checkhost=$(CHECK_HOST ${nip}) + if [ "${checkhost}" != "false" ]; then + ${NCMD} chown -R www-data:www-data /mnt/Nextcloud-Data + ${NCMD} find /mnt/Nextcloud-Data/ -type d -exec chmod 750 {} \; + ${NCMD} find /mnt/Nextcloud-Data/ -type f -exec chmod 640 {} \; if [ "${2}" != "q" ]; then - echo -en "${idsCL[Yellow]}Resetting folder permissions for Nextcloud on Nextcloud-Node${nid} (${nip})... ${idsCL[Default]}" + echo -e "${idsCL[Green]}Complete${idsCL[Default]}" fi - checkhost=$(CHECK_HOST ${nip}) - if [ "${checkhost}" != "false" ]; then - ${NCMD} chown -R www-data:www-data /mnt/Nextcloud-Data - ${NCMD} find /mnt/Nextcloud-Data/ -type d -exec chmod 750 {} \; - ${NCMD} find /mnt/Nextcloud-Data/ -type f -exec chmod 640 {} \; - if [ "${2}" != "q" ]; then - echo -e "${idsCL[Green]}Complete${idsCL[Default]}" - fi - elif [ "${2}" != "q" ]; then - echo -e "${idsCL[Red]}Node is down${idsCL[Default]}" - fi - nid=`expr $nid + 1` - done + elif [ "${2}" != "q" ]; then + echo -e "${idsCL[Red]}Node is down${idsCL[Default]}" + fi else DIVIDER if [ "${1}" != "" ]; then