From 279fe61b43d7782d4cd42d87cfc16d722f65617c Mon Sep 17 00:00:00 2001 From: uffhitech Date: Thu, 26 Aug 2021 10:42:21 +0300 Subject: [PATCH] chcustown with xargs old way is very slow - takes 15 minutes instead of 5 seconds (new way) on 602990 of file 43 Gb in size even on NVMe --- files/usr/local/sbin/chcustown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/usr/local/sbin/chcustown b/files/usr/local/sbin/chcustown index a130271..ec66c24 100755 --- a/files/usr/local/sbin/chcustown +++ b/files/usr/local/sbin/chcustown @@ -18,8 +18,8 @@ if [ -d ${DOCROOT} ]; then fi ionice -c 3 chown -R ${USER}:wordpress ${DOCROOT} - ionice -c 3 find ${DOCROOT} -type d -exec chmod 755 {} \; - ionice -c 3 find ${DOCROOT} -type f -exec chmod 644 {} \; + ionice -c 3 find ${DOCROOT} -type d -print0 | xargs -0 chmod 775 + ionice -c 3 find ${DOCROOT} -type f -print0 | xargs -0 chmod 644 echo ${DOMAIN} has been locked down. else echo ${DOCROOT} does not exist. Lockdown failed.