Operating System - HP-UX
1753731 Members
4806 Online
108799 Solutions
New Discussion юеВ

Re: need a script that will change the limits in the /etc/security/limits file

 
SOLVED
Go to solution
Paul.Romanek
New Member

need a script that will change the limits in the /etc/security/limits file

I need a script that will change the limits in the /etc/security/limits file. Primarily the files limit must be unlimited (-1). I have a list of server names that I would like to tie into the script. Each server will be accessed via remsh. Also will I need to reboot in order for the changes take place or can I just restart a service?

Any help is appreciated.

Thank you,

Paul Romanek


5 REPLIES 5
Fabio Ettore
Honored Contributor

Re: need a script that will change the limits in the /etc/security/limits file

Hi Paul,

what is the operating system you are talking about? Linux? If so you should post the question in Linux room:


http://forums12.itrc.hp.com/service/forums/familyhome.do?familyId=118

Anyway /etc/security/limits is an ascii file, I think it is to be edited manually to insert/modify something but that is just a thought, I don't know if there is a tool to change contents of that file.

Best regards,
Fabio
WISH? IMPROVEMENT!
Matti_Kurkela
Honored Contributor

Re: need a script that will change the limits in the /etc/security/limits file

/etc/security/limits does not exist in standard HP-UX 11.11 or 11.23. You probably mean the limits listed by "ulimit -a" and "ulimit -a -H" - am I correct?

These per-user limits are settable by the "ulimit" command.

Setting the number of open files (ulimit -n) to any value that is greater than the system-wide "nfile" kernel parameter allows any user to cause the machine to hang, simply by opening more files than the system can handle.

This does not quite crash the system, but it often comes close to that: essential services like inetd and/or sshd may crash when they cannot open a file whenever they need to. If the situation gets bad enough, a hard reboot may be the only way to recover (if all the file handles are in use, nobody can log in anymore!)

There are two limits: a "hard" limit and a "soft" limit. The soft limit can be adjusted by the user, from 0 to the value of the hard limit. The hard limit can be decreased, but not increased by an ordinary user. Any child processes inherit the limit values from their parent.

The default value for the soft "number of open files" per-user limit is set with the kernel parameter "maxfiles". The respective hard limit is set with the kernel parameter "maxfiles_lim".

My strategy with these limit values:
- Set "nfile" to very large value (your best estimate x4 or x8 is not an exaggeration). Making this value large costs very little memory.

- Set "maxfiles_lim" so that your most file-hungry application can live comfortably, allowing some room for growth.

- Set "maxfiles" so that (maxfiles * number of expected users) < nfile.

Now normal users will generally hit the per-user limit before hitting the system-wide limit. When starting the big, file-hungry application, you (or an informed user) can run "ulimit -n " to explicitly allow the application to use more files.

MK
MK
Paul.Romanek
New Member

Re: need a script that will change the limits in the /etc/security/limits file


I would like to make this change via the ulimit command. So basically what I need is a script that will remsh to a list servers that I have created. Once it's sucessfully remsh to a server in the list I would like the script to make a copy of the file /etc/security/limits then run the command ulimit -1 then exit and go on to the next server in the list. The script will be on a HP-UX server but the actually command will be on a AIX server. Any help appreciated.

-Paul
Dennis Handly
Acclaimed Contributor
Solution

Re: need a script that will change the limits in the /etc/security/limits file

>will I need to reboot in order for the changes take place

Questions about foreign devil OSes will get this thread removed.

for sys in $(< list-of-systems); do
remsh $sys -n "cp /etc/security/limits /etc/security/limits.old; ulimit -1"
done
Paul.Romanek
New Member

Re: need a script that will change the limits in the /etc/security/limits file

Thank you...that worked great!!!1

Sorry for bringing that other terrible terrible O.S. into this forum;)