From 8e37361b9ae99207674a1568e65c31dc2c0f1b53 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 5 Sep 2013 15:08:36 -0500 Subject: [PATCH] Via automagic, only call ulimit -n if running as root. Also, add comments because comments are cool. --- teuthology/task/adjust-ulimits | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/teuthology/task/adjust-ulimits b/teuthology/task/adjust-ulimits index 4fb558e108184..4825049f32428 100755 --- a/teuthology/task/adjust-ulimits +++ b/teuthology/task/adjust-ulimits @@ -1,5 +1,16 @@ #!/bin/sh +# If we're running as root, allow large amounts of open files. +USER=$(whoami) + +# If a ulimit call fails, exit immediately. set -e + +if [ "$USER" = "root" ] +then + # Enable large number of open files + ulimit -n 16384 +fi + +# Enable core dumps for everything ulimit -c unlimited -ulimit -n 16384 exec "$@" -- 2.39.5