diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index c3e7cd9f..20f257ed 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -1125,6 +1125,30 @@ SET-PERMISSIONS(){ fi 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 + if [ "${2}" != "q" ]; then + echo -en "${idsCL[Yellow]}Resetting folder permissions for Nextcloud on Nextcloud-Node${nid} (${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 -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 else DIVIDER if [ "${1}" != "" ]; then