Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a daemontools service whose /service/myservice/run contains:

#!/bin/sh
exec setuidgid someuser somecommand

Now, if I run this as a script directly from a root shell, somecommand will get a correct ulimit (unlimited).

However, when I start the service using

svc -u /service/myservice

then somecommand does get a ulimit effectively slightly above 11000.

How can I have somecommand get the correct ulimit even when started via svc (not from a shell)?

This is on FreeBSD 9 release.

share|improve this question
up vote 2 down vote accepted

Put the ulimit in the daemontools script, above the exec. svc does not propagate the rlimits to the scripts it runs:

#!/bin/sh
ulimit -n 102400 #Increase file descriptor limit to 102400
exec setuidgid someuser somecommand
share|improve this answer
    
thanks! that did the trick. – oberstet Jun 7 '12 at 16:46

Actually, this is what softlimit is for.

You should try:

exec setuidgid someuser softlimit -o 102400 somecommand

See: http://cr.yp.to/daemontools/softlimit.html

Note that -o controls open file descriptors for softlimit, unlike -n for ulimit.

share|improve this answer
    
Thanks for pointing this out! – oberstet Mar 23 '13 at 9:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .