ulimit not working for changing daemon limits
Greetings,
I am trying to increase the number of open files the sendmail daemon
may have. I have read that inserting a ulimit command in the init
script is the way to do this. I have adjusted the init script as so:
# head -n 25 /etc/init.d/sendmail
#!/bin/sh
### BEGIN INIT INFO
# Provides: sendmail
# Required-Start: $remote_fs $network $syslog
# Required-Stop: $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: powerful, efficient, and scalable Mail Transport Agent
# Description: Sendmail is an alternative Mail Transport Agent (MTA)
# for Debian. It is suitable for handling sophisticated
# mail configurations, although this means that its
# configuration can also be complex. Fortunately, simple
# thing can be done easily, and complex thing are possible,
# even if not easily understood ;) Sendmail is the *ONLY*
# MTA with a Turing complete language to control *ALL*
# aspects of delivery!
### END INIT INFO
ulimit -n 4096 || echo "Setting ulimit failed for sendmail daemon."
echo
echo Ulimit value for sendmail: `ulimit -n`
echo
# Author: Marc-Christian Petersen <m.c.p@kernel.linux-systeme.com>
I then reboot the system and I see this in my boot log:
>From /var/log/boot:
Wed Apr 11 10:54:28 2012:
Wed Apr 11 10:54:28 2012: Ulimit value for sendmail: 4096
Wed Apr 11 10:54:28 2012:
Wed Apr 11 10:54:28 2012: Starting Mail Transport Agent (MTA): sendmail
However, it looks like the sendmail daemon is still stuck at a maximum
of 1024 open files:
# cat /proc/1634/limits | grep 'Max open files'
Max open files 1024 1024 file
Any ideas of how I can change the maximum open files for sendmail or
what I am doing wrong?
FWIW, I did tweak the clamav-milter daemon using a ulimit in the init
script and it seemed to work:
# cat /proc/1892/limits | grep 'Max open files'
Max open files 4096 4096 files
Thanks for the help!
-mz
Reply to: