Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers 2

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
add comment

Actually, this is what softlimit is for.

You should try:

exec setuidgid someuser softlimit -n 102400 somecommand

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.