Improve performance of chown by doing a quick smoke test

pull/7/head
Patrick Double 10 years ago
parent bcca313eee
commit 38a39c1224

@ -1,11 +1,13 @@
#!/bin/bash
if [ "$(id -u abc)" != "$PUID" ]; then usermod -u "$PUID" abc ; fi
if [ "$(id -g abc)" != "$PGID" ]; then groupmod -o -g "$PGID" abc ; fi
find /config -not \( -user abc -a -group abc \) -exec chown abc:abc {} +
# May not be a good idea to mess with permissions set by Plex
#find /config -type f -a -perm -0660 -exec chmod ug+rw {} +
#find /config -type d -a -perm -0770 -exec chmod ug+rwx {} +
if [ -n "$PUID" -a "$(id -u abc)" != "$PUID" ]; then usermod -u "$PUID" abc ; fi
if [ -n "$PGID" -a "$(id -g abc)" != "$PGID" ]; then groupmod -o -g "$PGID" abc ; fi
# There will be a lot of files in the config and searching through all of them will take a long time.
# Only Plex should modify these, so do a quick test to see if we need to search deeper.
if [ -n "$( find /config -maxdepth 2 -not \( -user abc -a -group abc \) )" ]; then
find /config -not \( -user abc -a -group abc \) -exec chown abc:abc {} +
fi
echo "
-----------------------------------

Loading…
Cancel
Save