From 884435971392658d04116524636e14ab63c97a90 Mon Sep 17 00:00:00 2001 From: Chase Bolt Date: Wed, 16 Sep 2015 12:54:11 -0700 Subject: [PATCH] adding lockfile so it is only a onetime event and improving chown avg time --- init/90_chown_plex_owned_files.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/init/90_chown_plex_owned_files.sh b/init/90_chown_plex_owned_files.sh index 7705a2f..643c2c8 100644 --- a/init/90_chown_plex_owned_files.sh +++ b/init/90_chown_plex_owned_files.sh @@ -1,13 +1,11 @@ #!/bin/bash - if [ ! -d "/config/Library" ]; then -mkdir /config/Library -chown abc:abc /config/Library + mkdir /config/Library + chown abc:abc /config/Library fi - - -if [ ! -f "/config/Library/chown.log" ]; then - chown -Rc abc:root /config/Library >> /config/Library/chown.log -fi \ No newline at end of file +if [ ! -f "/config/Library/linuxserver-chown.lock" ]; then + find /config/Library ! \( -user abc -a -group root \) -print0 | xargs -0 chown abc:root + touch /config/Library/linuxserver-chown.lock +fi