| Jeremiah DeWitt Weiner 2006-03-16, 5:53 pm |
| cgw_jlw@tiscali.co.uk wrote:
> I've never come across this before, but lo-and-behold, "ulimit -f" can
> be used to set a maximum filesize.
> I don't see how you can trap the event where the filesize exceeds it's
> maximum and point output elsewhere, sorry.
A process which exceeds its maximum filesize gets SIGXFSZ, so you
could trap that and use a signal handler to say "close the existing file
and open a new one". I don't think the OP said exactly what his program
was doing, so it's hard to know whether the problem is best handled this
way or at another organizational/structural/syntactical level. For
example, maybe the output could go to standard out and get piped into
'split' instead.
--
Oh to have a lodge in some vast wilderness. Where rumors of oppression
and deceit, of unsuccessful and successful wars may never reach me
anymore.
-- William Cowper
|