limits.conf: howto set core file size?

Matt Roth mroth at imminc.com
Thu May 4 21:05:02 UTC 2006


Patrick wrote:

 > Thanks for the information. I was thinking about the login you
 > mentioned. The primary application I need this for is Asterisk. Like
 > apache it is started as root and by passing -U <user> -G <group>
 > parameters it will run as that <user>/<group> (asterisk/asterisk in my
 > case). Do I still need to add the info to the initscript or do I add it
 > to limits.conf?

I run a large scale Asterisk system on Fedora Core 3.  I had a problem 
where the default number of file descriptors wasn't adequate for the 
number of socket connections that were being opened.  Suffice it to say 
that I learned the information I'm passing on about ulimit and 
limits.conf the hard way.  I make all ulimit changes in the init script 
AND limits.conf.  That way they're applied in both of the following 
scenarios:

1) Asterisk is started automatically at boot.
2) Asterisk is started manually from a login prompt after a crash or 
maintenance downtime.

If you're planning on having a large number of concurrent calls, you 
should increase the maximum number of file descriptors so that you don't 
run into the same problem I did.  This can be done by adding the 
following lines to limits.conf:

<user>   soft   nofile   65536
<user>   hard   nofile   65536

And adding the following line to Asterisk's init script, prior to 
starting Asterisk itself:

ulimit -n 65536

If security isn't a major issue, I'd recommend running Asterisk as 
root.  There is a substantial amount of work involved in setting all of 
the permissions to run it properly as another user.

Here are a couple of scripts that you can use for starting Asterisk at 
boot and restarting it automatically if it crashes:

<http://svn.digium.com/view/asterisk/branches/1.2/contrib/init.d/rc.redhat.asterisk?rev=15615&view=markup>
<http://svn.digium.com/view/asterisk/branches/1.2/contrib/scripts/safe_asterisk?rev=21638&view=markup>

I'd be happy to continue helping you with your system, but we're getting 
a little off topic.  I'm also an active member of the Asterisk users 
list <http://lists.digium.com/mailman/listinfo/asterisk-users>, so I'll 
keep an eye out for your posts over there.  Feel free to contact me off 
list as well.

Matthew Roth
InterMedia Marketing Solutions
Software Engineer and Systems Developer




More information about the fedora-list mailing list