1753943 Members
9174 Online
108811 Solutions
New Discussion юеВ

file size limit

 
SOLVED
Go to solution
Jason_484
New Member

file size limit

hey,
can anyone tell me how can i restrict a text file size to 2 mb? is there any script i can run from time to time tht checks the file ?
4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: file size limit

You can set a ulimit but that will limit the maximum size of all files. Files can be read of any size but can only be written upto ulimit blocks by child processes. e.g.
ulimit -f 4096
would limit files to 4096 512-byte blocks (2MB).

You could put this in the user's .profile and the user would be allowed to decrease but not increase the value.
If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: file size limit

Be sure to put this ulimit into a specifc user's $HOME/.profile, and not into /etc/profile. If it was in /etc/profile, every user (including application users like oracle, email, etc,) will be affected. Also note that many programs do not handle a file size limit gracefully...they usually abort and lose all the data. Very few will simply truncate and quit.


Bill Hassell, sysadmin
Jason_484
New Member

Re: file size limit

thanks for ur expertise guys
Jason_484
New Member

Re: file size limit

thanks