1 |
On Thursday, August 02, 2012 11:38:32 AM Michael Orlitzky wrote: |
2 |
> On 08/02/12 01:52, Joost Roeleveld wrote: |
3 |
> > On Wednesday, August 01, 2012 10:41:41 AM Michael Orlitzky wrote: |
4 |
> >> Is there a blessed method these days for setting the ulimit per-daemon? |
5 |
> >> |
6 |
> >> The best I've been able to do is a global setting in /etc/rc.conf: |
7 |
> >> rc_ulimit="-s 1048576" |
8 |
> >> |
9 |
> >> The entries under /etc/security seem to be ignored when using |
10 |
> >> `/etc/init.d/foo start`. |
11 |
> > |
12 |
> > Michael, |
13 |
> > |
14 |
> > I had to change the "nofiles" ulimit setting for my webserver. For that, I |
15 |
> > simply added the settings to the following file: |
16 |
> > |
17 |
> > # cat /etc/security/limits.conf | grep apache |
18 |
> > apache hard nofile 4096 |
19 |
> > apache soft nofile 4096 |
20 |
> > |
21 |
> > I would expect the same to work for any other daemon? |
22 |
> |
23 |
> I thought so too, but it doesn't seem to be working (for any daemon, I |
24 |
> even tried with apache just now). |
25 |
> |
26 |
> Can you `cat /proc/<pid>/limits` on one of those apache processes? I get |
27 |
> whatever was set for my bash shell rather than what I have in limits.conf. |
28 |
|
29 |
I do get 4096. |
30 |
Just had another good look at my notes, I also changed the init-file (Added |
31 |
the ulimit-statement here): |
32 |
*** |
33 |
start() { |
34 |
checkconfig || return 1 |
35 |
|
36 |
[ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache |
37 |
|
38 |
ebegin "Starting ${SVCNAME}" |
39 |
++++ ulimit -n 4096 |
40 |
${APACHE2} ${APACHE2_OPTS} -k start |
41 |
|
42 |
i=0 |
43 |
while [ ! -e "${PIDFILE}" ] && [ $i -lt ${TIMEOUT} ]; do |
44 |
sleep 1 && i=$(expr $i + 1) |
45 |
done |
46 |
|
47 |
test -e "${PIDFILE}" |
48 |
eend $? |
49 |
} |
50 |
|
51 |
*** |
52 |
|
53 |
I don't think there is a consistent method of making this change more |
54 |
permanent. |
55 |
|
56 |
-- |
57 |
Joost |