]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Via automagic, only call ulimit -n if running as root.
authorZack Cerza <zack@cerza.org>
Thu, 5 Sep 2013 20:08:36 +0000 (15:08 -0500)
committerZack Cerza <zack@cerza.org>
Thu, 5 Sep 2013 21:30:28 +0000 (16:30 -0500)
Also, add comments because comments are cool.

teuthology/task/adjust-ulimits

index 4fb558e108184b9b940845fb6006a3cc90da09aa..4825049f324283d004d39df0822cf3739ef4b6be 100755 (executable)
@@ -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 "$@"