(bug 44044) Check for existence of the timeout script in ulimit5.sh
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 25 Jan 2013 21:24:17 +0000 (13:24 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 25 Jan 2013 23:51:50 +0000 (15:51 -0800)
Change-Id: I89d5dd6535a6b37cadcafd12affaad1a82af22ba

bin/ulimit5.sh

index 3f24172..fd8aae2 100644 (file)
@@ -9,8 +9,8 @@ fi
 if [ "$3" -gt 0 ]; then
        ulimit -f "$3"
 fi
-if [ "$4" -gt 0 ]; then
-       timeout $4 /bin/bash -c "$5"
+if [ "$4" -gt 0 -a -x "/usr/bin/timeout" ]; then
+       /usr/bin/timeout $4 /bin/bash -c "$5"
        STATUS="$?"
        if [ "$STATUS" == 124 ]; then
                echo "ulimit5.sh: timed out." 1>&2