LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-14-2011, 08:48 AM   #1
mitchSmith
LQ Newbie
 
Registered: Jun 2011
Location: London
Posts: 4

Rep: Reputation: Disabled
/etc/security/limits.conf --> chkconfig startup script


Hi,

I have a server setup to host a web application using apache tomcat, with high throughput. Due to the high load I have increased the Maximum file descriptor limits, in /etc/security/limits.conf

Code:
*               soft    nofile          3072
*               hard    nofile          3072
I have a startup script in /etc/init.d/tomcat1, which starts the tomcat server, but fails to include the changes made to the limits.conf file. (Checked via jConsole - Still at default of 1024)

Code:
#! /bin/bash
#
# tomcat          Start/Stop the Tomcat Http/Servlet server.
#
# chkconfig: 23456 99 65
# description: Tomcat is a java based HTTP/Servlet server
# processname: tomcat
# pidfile: /var/run/tomcat.pid

# Source function library.
. /etc/init.d/functions
. /etc/profile

RETVAL=0
TOMCAT_HOME=/usr/local/apache-tomcat/
# See how we were called.

start() {
        echo -n $"Starting Tomcat "
        $TOMCAT_HOME/bin/startup.sh
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch  /var/lock/subsys/tomcat
        return $RETVAL
}

stop() {
        echo -n $"Stopping Tomcat "
        $TOMCAT_HOME/bin/shutdown.sh
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/tomcat
        return $RETVAL
}

restart() {
        stop
        start
}


case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  status)
        ps ax | grep $TOMCAT_HOME
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart}"
        exit 1
esac

exit $?
If I execute this script to start tomcat manually the limits are loaded, so why doesn't it use/load with the limits from boot?

Is there any way I can get the limits.conf to load prior to this startup script.

any information on how and when these limits are loaded would be a great help.

thanks,
Mitchell
 
Old 06-14-2011, 09:44 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You can add:
Code:
ulimit -HSn 3072
at the beginning of your startup script, or even in tomcat's startup.sh script
Cheers
 
Old 06-22-2011, 04:19 AM   #3
mitchSmith
LQ Newbie
 
Registered: Jun 2011
Location: London
Posts: 4

Original Poster
Rep: Reputation: Disabled
ulimit -n works

Hi,

Adding ulimit -n xxxx to the startup script works, however I am would prefer to know why I cannot use the limits set in /etc/security/limits.conf?

Anyone??

Thanks
M
 
Old 06-23-2011, 04:41 AM   #4
nooneknowme
Member
 
Registered: Feb 2008
Location: Bangalore, India
Posts: 69

Rep: Reputation: 5
Settings inside the user's profile over rights limits.conf. You might want to start by checking the user's profile.... .( bashrc , .profile depending on the shell used)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /etc/security/limits.conf and nice Mr. Alex Linux - Newbie 4 02-19-2011 04:44 PM
ulimit and /etc/security/limits.conf chakkerz Linux - General 2 01-23-2011 01:42 AM
etc/security/limits.conf - what does it do? Ken_1969 Red Hat 5 03-14-2010 04:25 PM
/etc/security/limits.conf reverse Linux - Security 4 10-20-2007 03:10 PM
/etc/security/limits.conf documentation? crazyeddie740 Linux - Security 1 06-19-2004 03:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration