reducing sample size to 5 for chown logic as it is not recursive

This commit is contained in:
thelamer
2019-03-28 08:11:03 -07:00
committed by Ryan Kuba
parent 2ce4be8c28
commit c3b57f9aa2

View File

@@ -39,10 +39,10 @@ done
# set queue driver to database # set queue driver to database
sed -i 's/QUEUE_DRIVER=sync/QUEUE_DRIVER=database/' /config/www/.env sed -i 's/QUEUE_DRIVER=sync/QUEUE_DRIVER=database/' /config/www/.env
# function to randomly sample 50 files for their owner and only chown if not abc # function to randomly sample 5 files for their owner and only chown if not abc
chowner () { chowner () {
files=(${1}/*) files=(${1}/*)
for i in {1..50}; do for i in {1..5}; do
user=$(stat -c '%U' $(printf "%s\n" "${files[RANDOM % ${#files[@]}]}")) user=$(stat -c '%U' $(printf "%s\n" "${files[RANDOM % ${#files[@]}]}"))
if [ "${user}" != "abc" ]; then if [ "${user}" != "abc" ]; then
chown -R abc:abc ${1} chown -R abc:abc ${1}