Skip to content

Commit

Permalink
Fixing slow chown on boot up.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Hernandez committed Mar 2, 2016
1 parent 5a0e383 commit 0b7b453
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion docker-containers/beta/root/var/cache/scripts/emby-server
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ prepare_docker_volume_parameters() {
if [ ! -d "${APP_CONFIG}" ]; then
mkdir -p ${APP_CONFIG}
fi
chown -R ${APP_UID}:${APP_GID} ${APP_CONFIG}

CURR_UID=$(stat -c%u ${APP_CONFIG})
CURR_GID=$(stat -c%u ${APP_CONFIG})
if [ "$CURR_UID" != "$APP_UID" ] || [ "$CURR_GID" != "$APP_GID" ]; then
chown -R $APP_UID:$APP_GID ${APP_CONFIG}
fi

# prepare local filesystems
VOLUMES+=" --volume=${APP_CONFIG}:/config"
}
Expand Down
8 changes: 7 additions & 1 deletion docker-containers/dev/root/var/cache/scripts/emby-server
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ prepare_docker_volume_parameters() {
if [ ! -d "${APP_CONFIG}" ]; then
mkdir -p ${APP_CONFIG}
fi
chown -R ${APP_UID}:${APP_GID} ${APP_CONFIG}

CURR_UID=$(stat -c%u ${APP_CONFIG})
CURR_GID=$(stat -c%u ${APP_CONFIG})
if [ "$CURR_UID" != "$APP_UID" ] || [ "$CURR_GID" != "$APP_GID" ]; then
chown -R $APP_UID:$APP_GID ${APP_CONFIG}
fi

# prepare local filesystems
VOLUMES+=" --volume=${APP_CONFIG}:/config"
}
Expand Down
8 changes: 7 additions & 1 deletion docker-containers/stable/root/var/cache/scripts/emby-server
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ prepare_docker_volume_parameters() {
if [ ! -d "${APP_CONFIG}" ]; then
mkdir -p ${APP_CONFIG}
fi
chown -R ${APP_UID}:${APP_GID} ${APP_CONFIG}

CURR_UID=$(stat -c%u ${APP_CONFIG})
CURR_GID=$(stat -c%u ${APP_CONFIG})
if [ "$CURR_UID" != "$APP_UID" ] || [ "$CURR_GID" != "$APP_GID" ]; then
chown -R $APP_UID:$APP_GID ${APP_CONFIG}
fi

# prepare local filesystems
VOLUMES+=" --volume=${APP_CONFIG}:/config"
}
Expand Down

2 comments on commit 0b7b453

@ggzengel
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To have it more efficient:

CURR_SID=$(stat -c"%u:%g" ${APP_CONFIG})
if [ "$CURR_SID" != "$APP_UID:$APP_GID" ]
chown -R $APP_UID:$APP_GID ${APP_CONFIG}
fi

@hurricanehrndz
Copy link
Contributor

@hurricanehrndz hurricanehrndz commented on 0b7b453 Mar 5, 2016 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.