On Thursday, August 02, 2012 11:38:32 AM Michael Orlitzky wrote:
> On 08/02/12 01:52, Joost Roeleveld wrote:
> > On Wednesday, August 01, 2012 10:41:41 AM Michael Orlitzky wrote:
> >> Is there a blessed method these days for setting the ulimit per-daemon?
> >> 
> >> The best I've been able to do is a global setting in /etc/rc.conf:
> >>   rc_ulimit="-s 1048576"
> >> 
> >> The entries under /etc/security seem to be ignored when using
> >> `/etc/init.d/foo start`.
> > 
> > Michael,
> > 
> > I had to change the "nofiles" ulimit setting for my webserver. For that, I
> > simply added the settings to the following file:
> > 
> > # cat /etc/security/limits.conf | grep apache
> > apache        hard  nofile   4096
> > apache        soft  nofile   4096
> > 
> > I would expect the same to work for any other daemon?
> 
> I thought so too, but it doesn't seem to be working (for any daemon, I
> even tried with apache just now).
> 
> Can you `cat /proc/<pid>/limits` on one of those apache processes? I get
> whatever was set for my bash shell rather than what I have in limits.conf.

I do get 4096.
Just had another good look at my notes, I also changed the init-file (Added 
the ulimit-statement here):
***
start() {
        checkconfig || return 1

        [ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache

        ebegin "Starting ${SVCNAME}"
++++        ulimit -n 4096
        ${APACHE2} ${APACHE2_OPTS} -k start

        i=0
        while [ ! -e "${PIDFILE}" ] && [ $i -lt ${TIMEOUT} ]; do
                sleep 1 && i=$(expr $i + 1)
        done

        test -e "${PIDFILE}"
        eend $?
}

***

I don't think there is a consistent method of making this change more 
permanent.

--
Joost

Reply via email to