Skip to content

Commit

Permalink
Adjusted nice permission check to be compatible with debian.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlesage committed May 15, 2017
1 parent 6346d1f commit 5de445c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rootfs/etc/cont-init.d/00-app-niceness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ set -u # Treat unset variables as an error.
APP_NICE_CMD=' '

if [ "${APP_NICENESS:-UNSET}" != "UNSET" ]; then
APP_NICE_CMD="nice -n $APP_NICENESS"
APP_NICE_CMD="$(which nice) -n $APP_NICENESS"

if ! $APP_NICE_CMD echo &> /dev/null; then
# NOTE: On debian systems, nice always has an exit code of `0`, even when
# permission is denied. Look for the error message instead.
if [ "$($APP_NICE_CMD true 2>&1)" != "" ]; then
echo "ERROR: Permission denied to set application's niceness to" \
"$APP_NICENESS. Make sure the container is started with the" \
"--cap-add=SYS_NICE option."
Expand Down

0 comments on commit 5de445c

Please sign in to comment.